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