mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-17 03:05:13 +00:00
changed naming to space
This commit is contained in:
@ -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,
|
||||
);
|
||||
|
@ -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,
|
||||
|
Reference in New Issue
Block a user