fix automation get endpoint remove return Auto_

This commit is contained in:
faris Aljohari
2024-11-24 16:09:21 -06:00
parent 4d0c91db19
commit 6b66bf2b20
2 changed files with 14 additions and 9 deletions

View File

@ -1,4 +1,3 @@
// automation.enum.ts
export enum ActionExecutorEnum {
DEVICE_ISSUE = 'device_issue',
DELAY = 'delay',
@ -17,3 +16,5 @@ export const AUTOMATION_CONFIG = {
COMPARATOR: '==',
SCENE_STATUS_VALUE: 'scene',
};
export const AUTOMATION_TYPE = 'automation';
export const AUTO_PREFIX = 'Auto_';

View File

@ -26,6 +26,8 @@ import {
import { convertKeysToCamelCase } from '@app/common/helper/camelCaseConverter';
import {
ActionExecutorEnum,
AUTO_PREFIX,
AUTOMATION_TYPE,
EntityTypeEnum,
} from '@app/common/constants/automation.enum';
import { TuyaService } from '@app/common/integrations/tuya/services/tuya.service';
@ -154,12 +156,14 @@ export class AutomationService {
throw new HttpException(response.msg, HttpStatus.BAD_REQUEST);
}
return response.result.list.map((item) => {
return response.result.list
.filter((item) => item.name && !item.name.startsWith(AUTO_PREFIX))
.map((item) => {
return {
id: item.id,
name: item.name,
status: item.status,
type: 'automation',
type: AUTOMATION_TYPE,
};
});
} catch (err) {