mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-14 18:05:48 +00:00
fix automation get endpoint remove return Auto_
This commit is contained in:
@ -1,4 +1,3 @@
|
|||||||
// automation.enum.ts
|
|
||||||
export enum ActionExecutorEnum {
|
export enum ActionExecutorEnum {
|
||||||
DEVICE_ISSUE = 'device_issue',
|
DEVICE_ISSUE = 'device_issue',
|
||||||
DELAY = 'delay',
|
DELAY = 'delay',
|
||||||
@ -17,3 +16,5 @@ export const AUTOMATION_CONFIG = {
|
|||||||
COMPARATOR: '==',
|
COMPARATOR: '==',
|
||||||
SCENE_STATUS_VALUE: 'scene',
|
SCENE_STATUS_VALUE: 'scene',
|
||||||
};
|
};
|
||||||
|
export const AUTOMATION_TYPE = 'automation';
|
||||||
|
export const AUTO_PREFIX = 'Auto_';
|
||||||
|
@ -26,6 +26,8 @@ import {
|
|||||||
import { convertKeysToCamelCase } from '@app/common/helper/camelCaseConverter';
|
import { convertKeysToCamelCase } from '@app/common/helper/camelCaseConverter';
|
||||||
import {
|
import {
|
||||||
ActionExecutorEnum,
|
ActionExecutorEnum,
|
||||||
|
AUTO_PREFIX,
|
||||||
|
AUTOMATION_TYPE,
|
||||||
EntityTypeEnum,
|
EntityTypeEnum,
|
||||||
} from '@app/common/constants/automation.enum';
|
} from '@app/common/constants/automation.enum';
|
||||||
import { TuyaService } from '@app/common/integrations/tuya/services/tuya.service';
|
import { TuyaService } from '@app/common/integrations/tuya/services/tuya.service';
|
||||||
@ -154,14 +156,16 @@ export class AutomationService {
|
|||||||
throw new HttpException(response.msg, HttpStatus.BAD_REQUEST);
|
throw new HttpException(response.msg, HttpStatus.BAD_REQUEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
return response.result.list.map((item) => {
|
return response.result.list
|
||||||
return {
|
.filter((item) => item.name && !item.name.startsWith(AUTO_PREFIX))
|
||||||
id: item.id,
|
.map((item) => {
|
||||||
name: item.name,
|
return {
|
||||||
status: item.status,
|
id: item.id,
|
||||||
type: 'automation',
|
name: item.name,
|
||||||
};
|
status: item.status,
|
||||||
});
|
type: AUTOMATION_TYPE,
|
||||||
|
};
|
||||||
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (err instanceof BadRequestException) {
|
if (err instanceof BadRequestException) {
|
||||||
throw err; // Re-throw BadRequestException
|
throw err; // Re-throw BadRequestException
|
||||||
|
Reference in New Issue
Block a user