mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-11-26 20:44:53 +00:00
Merge pull request #157 from SyncrowIOT/fix-space-column-issue-in-scene-table
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,
|
sceneTuyaUuid: response.result.id,
|
||||||
sceneIcon: { uuid: iconUuid || defaultSceneIcon.uuid },
|
sceneIcon: { uuid: iconUuid || defaultSceneIcon.uuid },
|
||||||
showInHomePage,
|
showInHomePage,
|
||||||
spaceUuid,
|
space: { uuid: spaceUuid },
|
||||||
});
|
});
|
||||||
|
|
||||||
return scene;
|
return scene;
|
||||||
@ -174,7 +174,7 @@ export class SceneService {
|
|||||||
|
|
||||||
const scenesData = await this.sceneRepository.find({
|
const scenesData = await this.sceneRepository.find({
|
||||||
where: {
|
where: {
|
||||||
spaceUuid,
|
space: { uuid: spaceUuid },
|
||||||
...(showInHomePage ? { showInHomePage } : {}),
|
...(showInHomePage ? { showInHomePage } : {}),
|
||||||
},
|
},
|
||||||
relations: ['sceneIcon'],
|
relations: ['sceneIcon'],
|
||||||
@ -278,11 +278,11 @@ export class SceneService {
|
|||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
const scene = await this.findScene(sceneUuid);
|
const scene = await this.findScene(sceneUuid);
|
||||||
const space = await this.getSpaceByUuid(scene.spaceUuid);
|
const space = await this.getSpaceByUuid(scene.space.uuid);
|
||||||
|
|
||||||
const addSceneTapToRunDto: AddSceneTapToRunDto = {
|
const addSceneTapToRunDto: AddSceneTapToRunDto = {
|
||||||
...updateSceneTapToRunDto,
|
...updateSceneTapToRunDto,
|
||||||
spaceUuid: scene.spaceUuid,
|
spaceUuid: scene.space.uuid,
|
||||||
iconUuid: updateSceneTapToRunDto.iconUuid,
|
iconUuid: updateSceneTapToRunDto.iconUuid,
|
||||||
showInHomePage: updateSceneTapToRunDto.showInHomePage,
|
showInHomePage: updateSceneTapToRunDto.showInHomePage,
|
||||||
};
|
};
|
||||||
@ -310,7 +310,7 @@ export class SceneService {
|
|||||||
sceneIcon: {
|
sceneIcon: {
|
||||||
uuid: addSceneTapToRunDto.iconUuid,
|
uuid: addSceneTapToRunDto.iconUuid,
|
||||||
},
|
},
|
||||||
spaceUuid: scene.spaceUuid,
|
space: { uuid: scene.space.uuid },
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
return new SuccessResponseDto({
|
return new SuccessResponseDto({
|
||||||
@ -438,7 +438,7 @@ export class SceneService {
|
|||||||
showInHome: scene.showInHomePage,
|
showInHome: scene.showInHomePage,
|
||||||
type: 'tap_to_run',
|
type: 'tap_to_run',
|
||||||
actions,
|
actions,
|
||||||
spaceId: scene.spaceUuid,
|
spaceId: scene.space.uuid,
|
||||||
};
|
};
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (err instanceof BadRequestException) {
|
if (err instanceof BadRequestException) {
|
||||||
@ -456,7 +456,7 @@ export class SceneService {
|
|||||||
try {
|
try {
|
||||||
const { sceneUuid } = params;
|
const { sceneUuid } = params;
|
||||||
const scene = await this.findScene(sceneUuid);
|
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.delete(scene.sceneTuyaUuid, space.spaceTuyaUuid);
|
||||||
await this.sceneRepository.delete({ uuid: sceneUuid });
|
await this.sceneRepository.delete({ uuid: sceneUuid });
|
||||||
|
|||||||
Reference in New Issue
Block a user