mirror of
https://github.com/SyncrowIOT/backend.git
synced 2026-10-23 11:27:54 +00:00
Update getScene method to accept sceneUuid and use it for spaceId
This commit is contained in:
@@ -190,7 +190,10 @@ export class SceneService {
|
||||
const scenes = await Promise.all(
|
||||
scenesData.map(async (scene) => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const { actions, ...sceneDetails } = await this.getScene(scene);
|
||||
const { actions, ...sceneDetails } = await this.getScene(
|
||||
scene,
|
||||
spaceUuid,
|
||||
);
|
||||
|
||||
return sceneDetails;
|
||||
}),
|
||||
@@ -376,7 +379,7 @@ export class SceneService {
|
||||
async getSceneByUuid(sceneUuid: string): Promise<BaseResponseDto> {
|
||||
try {
|
||||
const scene = await this.findScene(sceneUuid);
|
||||
const sceneDetails = await this.getScene(scene);
|
||||
const sceneDetails = await this.getScene(scene, sceneUuid);
|
||||
|
||||
return new SuccessResponseDto({
|
||||
data: sceneDetails,
|
||||
@@ -399,7 +402,7 @@ export class SceneService {
|
||||
}
|
||||
}
|
||||
|
||||
async getScene(scene: SceneEntity): Promise<SceneDetails> {
|
||||
async getScene(scene: SceneEntity, sceneUuid: string): Promise<SceneDetails> {
|
||||
try {
|
||||
const { actions, name, status } = await this.fetchSceneDetailsFromTuya(
|
||||
scene.sceneTuyaUuid,
|
||||
@@ -438,7 +441,7 @@ export class SceneService {
|
||||
showInHome: scene.showInHomePage,
|
||||
type: 'tap_to_run',
|
||||
actions,
|
||||
spaceId: scene.space.uuid,
|
||||
spaceId: sceneUuid,
|
||||
};
|
||||
} catch (err) {
|
||||
if (err instanceof BadRequestException) {
|
||||
|
||||
Reference in New Issue
Block a user