From 9721cb765f58f70177de237a9f43863df7271bfc Mon Sep 17 00:00:00 2001 From: faris Aljohari <83524184+farisaljohari@users.noreply.github.com> Date: Sun, 24 Nov 2024 23:43:27 -0600 Subject: [PATCH] Update scene service to use space object instead of spaceUuid --- src/scene/services/scene.service.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/scene/services/scene.service.ts b/src/scene/services/scene.service.ts index 33bc44e..c3dff2b 100644 --- a/src/scene/services/scene.service.ts +++ b/src/scene/services/scene.service.ts @@ -106,7 +106,7 @@ export class SceneService { sceneTuyaUuid: response.result.id, sceneIcon: { uuid: iconUuid || defaultSceneIcon.uuid }, showInHomePage, - spaceUuid, + space: { uuid: spaceUuid }, }); return scene; @@ -174,7 +174,7 @@ export class SceneService { const scenesData = await this.sceneRepository.find({ where: { - spaceUuid, + space: { uuid: spaceUuid }, ...(showInHomePage ? { showInHomePage } : {}), }, relations: ['sceneIcon'], @@ -278,11 +278,11 @@ export class SceneService { ) { try { const scene = await this.findScene(sceneUuid); - const space = await this.getSpaceByUuid(scene.spaceUuid); + const space = await this.getSpaceByUuid(scene.space.uuid); const addSceneTapToRunDto: AddSceneTapToRunDto = { ...updateSceneTapToRunDto, - spaceUuid: scene.spaceUuid, + spaceUuid: scene.space.uuid, iconUuid: updateSceneTapToRunDto.iconUuid, showInHomePage: updateSceneTapToRunDto.showInHomePage, }; @@ -310,7 +310,7 @@ export class SceneService { sceneIcon: { uuid: addSceneTapToRunDto.iconUuid, }, - spaceUuid: scene.spaceUuid, + space: { uuid: scene.space.uuid }, }, ); return new SuccessResponseDto({ @@ -438,7 +438,7 @@ export class SceneService { showInHome: scene.showInHomePage, type: 'tap_to_run', actions, - spaceId: scene.spaceUuid, + spaceId: scene.space.uuid, }; } catch (err) { if (err instanceof BadRequestException) { @@ -456,7 +456,7 @@ export class SceneService { try { const { sceneUuid } = params; const scene = await this.findScene(sceneUuid); - const space = await this.getSpaceByUuid(scene.spaceUuid); + const space = await this.getSpaceByUuid(scene.space.uuid); await this.delete(scene.sceneTuyaUuid, space.spaceTuyaUuid); await this.sceneRepository.delete({ uuid: sceneUuid });