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,
@Query() inHomePage: GetSceneDto,
) {
const tapToRunScenes = await this.sceneService.getTapToRunSceneByUnit(
const tapToRunScenes = await this.sceneService.getTapToRunSceneBySpace(
param.spaceUuid,
inHomePage,
);

View File

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