mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-17 03:05:13 +00:00
Update scene service to use space object instead of spaceUuid
This commit is contained in:
@ -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 });
|
||||
|
Reference in New Issue
Block a user