updated spaceUuid

This commit is contained in:
hannathkadher
2024-10-30 23:50:52 +04:00
parent 689d42cf1e
commit f1c07360cb
4 changed files with 23 additions and 15 deletions
+14 -8
View File
@@ -113,7 +113,7 @@ export class SceneService {
: defaultSceneIcon.uuid,
},
showInHomePage: addSceneTapToRunDto.showInHomePage,
unitUuid: spaceUuid ? spaceUuid : addSceneTapToRunDto.spaceUuid,
spaceUuid: spaceUuid ? spaceUuid : addSceneTapToRunDto.spaceUuid,
});
}
return {
@@ -124,7 +124,7 @@ export class SceneService {
throw err; // Re-throw BadRequestException
} else {
throw new HttpException(
err.message || 'Scene not found',
err.message || `Scene not found`,
err.status || HttpStatus.NOT_FOUND,
);
}
@@ -160,13 +160,14 @@ export class SceneService {
}
}
}
async getTapToRunSceneByUnit(unitUuid: string, inHomePage: GetSceneDto) {
async getTapToRunSceneByUnit(spaceUuid: string, inHomePage: GetSceneDto) {
try {
const showInHomePage = inHomePage?.showInHomePage;
const scenesData = await this.sceneRepository.find({
where: {
unitUuid,
spaceUuid,
...(showInHomePage ? { showInHomePage } : {}),
},
});
@@ -180,6 +181,7 @@ export class SceneService {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { actions, ...rest } = sceneData;
return {
uuid: scene.uuid,
...rest,
};
}),
@@ -197,6 +199,7 @@ export class SceneService {
}
}
}
async deleteTapToRunScene(param: DeleteSceneParamDto, spaceTuyaId = null) {
const { spaceUuid, sceneUuid } = param;
try {
@@ -317,7 +320,10 @@ export class SceneService {
if (err instanceof BadRequestException) {
throw err; // Re-throw BadRequestException
} else {
throw new HttpException('Scene not found', HttpStatus.NOT_FOUND);
throw new HttpException(
`Scene not found for ${sceneId}`,
HttpStatus.NOT_FOUND,
);
}
}
}
@@ -375,7 +381,7 @@ export class SceneService {
const newTapToRunScene = await this.addTapToRunScene(
addSceneTapToRunDto,
spaceTuyaId.spaceId,
scene.unitUuid,
scene.spaceUuid,
);
const param: DeleteSceneParamDto = {
@@ -394,7 +400,7 @@ export class SceneService {
sceneIcon: {
uuid: addSceneTapToRunDto.iconUuid,
},
unitUuid: scene.unitUuid,
spaceUuid: scene.spaceUuid,
},
);
return newTapToRunScene;
@@ -404,7 +410,7 @@ export class SceneService {
throw err; // Re-throw BadRequestException
} else {
throw new HttpException(
err.message || 'Scene not found',
err.message || `Scene not found for id ${sceneUuid}`,
err.status || HttpStatus.NOT_FOUND,
);
}