changed naming to space

This commit is contained in:
hannathkadher
2024-10-31 12:03:38 +04:00
parent 8180d07a04
commit c12038f2ef
2 changed files with 11 additions and 11 deletions

View File

@ -51,7 +51,7 @@ export class SceneController {
@Param() param: SpaceParamDto, @Param() param: SpaceParamDto,
@Query() inHomePage: GetSceneDto, @Query() inHomePage: GetSceneDto,
) { ) {
const tapToRunScenes = await this.sceneService.getTapToRunSceneByUnit( const tapToRunScenes = await this.sceneService.getTapToRunSceneBySpace(
param.spaceUuid, param.spaceUuid,
inHomePage, inHomePage,
); );

View File

@ -55,17 +55,17 @@ export class SceneService {
spaceUuid?: string, spaceUuid?: string,
) { ) {
try { try {
let unitSpaceTuyaId; let tuyaSpaceId;
if (!spaceTuyaId) { if (!spaceTuyaId) {
const space = await this.getSpaceByUuid(addSceneTapToRunDto.spaceUuid); const space = await this.getSpaceByUuid(addSceneTapToRunDto.spaceUuid);
unitSpaceTuyaId = space.spaceTuyaUuid; tuyaSpaceId = space.spaceTuyaUuid;
if (!space) { if (!space) {
throw new BadRequestException( throw new BadRequestException(
`Invalid space UUID ${addSceneTapToRunDto.spaceUuid}`, `Invalid space UUID ${addSceneTapToRunDto.spaceUuid}`,
); );
} }
} else { } else {
unitSpaceTuyaId = spaceTuyaId; tuyaSpaceId = spaceTuyaId;
} }
const actions = addSceneTapToRunDto.actions.map((action) => { const actions = addSceneTapToRunDto.actions.map((action) => {
@ -91,7 +91,7 @@ export class SceneService {
method: 'POST', method: 'POST',
path, path,
body: { body: {
space_id: unitSpaceTuyaId, space_id: tuyaSpaceId,
name: addSceneTapToRunDto.sceneName, name: addSceneTapToRunDto.sceneName,
type: 'scene', type: 'scene',
decision_expr: addSceneTapToRunDto.decisionExpr, decision_expr: addSceneTapToRunDto.decisionExpr,
@ -161,7 +161,7 @@ export class SceneService {
} }
} }
async getTapToRunSceneByUnit(spaceUuid: string, inHomePage: GetSceneDto) { async getTapToRunSceneBySpace(spaceUuid: string, inHomePage: GetSceneDto) {
try { try {
const showInHomePage = inHomePage?.showInHomePage; const showInHomePage = inHomePage?.showInHomePage;
@ -203,18 +203,18 @@ export class SceneService {
async deleteTapToRunScene(param: DeleteSceneParamDto, spaceTuyaId = null) { async deleteTapToRunScene(param: DeleteSceneParamDto, spaceTuyaId = null) {
const { spaceUuid, sceneUuid } = param; const { spaceUuid, sceneUuid } = param;
try { try {
let unitSpaceTuyaId; let tuyaSpaceId;
if (!spaceTuyaId) { if (!spaceTuyaId) {
const space = await this.getSpaceByUuid(spaceUuid); const space = await this.getSpaceByUuid(spaceUuid);
unitSpaceTuyaId = space.spaceTuyaUuid; tuyaSpaceId = space.spaceTuyaUuid;
if (!unitSpaceTuyaId) { if (!tuyaSpaceId) {
throw new BadRequestException(`Invalid space UUID ${spaceUuid}`); throw new BadRequestException(`Invalid space UUID ${spaceUuid}`);
} }
} else { } else {
unitSpaceTuyaId = spaceTuyaId; tuyaSpaceId = spaceTuyaId;
} }
const path = `/v2.0/cloud/scene/rule?ids=${sceneUuid}&space_id=${unitSpaceTuyaId}`; const path = `/v2.0/cloud/scene/rule?ids=${sceneUuid}&space_id=${tuyaSpaceId}`;
const response: DeleteTapToRunSceneInterface = await this.tuya.request({ const response: DeleteTapToRunSceneInterface = await this.tuya.request({
method: 'DELETE', method: 'DELETE',
path, path,