Merge pull request #317 from SyncrowIOT/SP-1331-be-return-space-name-in-get-scene-and-get-automation-by-space-apis

SP-1331-be-return-space-name-in-get-scene-and-get-automation-by-space-apis
This commit is contained in:
faris Aljohari
2025-03-19 11:05:53 +03:00
committed by GitHub
3 changed files with 8 additions and 2 deletions

View File

@ -260,6 +260,8 @@ export class AutomationService {
name: automationDetails.result.name, name: automationDetails.result.name,
status: automationDetails.result.status, status: automationDetails.result.status,
type: AUTOMATION_TYPE, type: AUTOMATION_TYPE,
spaceId: automation.space.uuid,
spaceName: automation.space.spaceName,
}; };
} catch (error) { } catch (error) {
console.warn( console.warn(

View File

@ -42,4 +42,5 @@ export interface SceneDetails {
type: string; type: string;
actions: Action[]; actions: Action[];
spaceId: string; spaceId: string;
spaceName: string;
} }

View File

@ -231,6 +231,8 @@ export class SceneService {
const safeFetch = async (scene: any) => { const safeFetch = async (scene: any) => {
try { try {
console.log('scene', scene);
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
const { actions, ...sceneDetails } = await this.getScene( const { actions, ...sceneDetails } = await this.getScene(
scene, scene,
@ -443,7 +445,7 @@ export class SceneService {
} }
} }
async getScene(scene: SceneEntity, sceneUuid: string): Promise<SceneDetails> { async getScene(scene: SceneEntity, spaceUuid: string): Promise<SceneDetails> {
try { try {
const { actions, name, status } = await this.fetchSceneDetailsFromTuya( const { actions, name, status } = await this.fetchSceneDetailsFromTuya(
scene.sceneTuyaUuid, scene.sceneTuyaUuid,
@ -490,7 +492,8 @@ export class SceneService {
showInHome: scene.showInHomePage, showInHome: scene.showInHomePage,
type: 'tap_to_run', type: 'tap_to_run',
actions, actions,
spaceId: sceneUuid, spaceId: spaceUuid,
spaceName: scene.space.spaceName,
}; };
} catch (err) { } catch (err) {
if (err instanceof BadRequestException) { if (err instanceof BadRequestException) {