mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-14 09:57:28 +00:00
fix automation get endpoint remove return Auto_
This commit is contained in:
@ -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,14 +156,16 @@ export class AutomationService {
|
||||
throw new HttpException(response.msg, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
return response.result.list.map((item) => {
|
||||
return {
|
||||
id: item.id,
|
||||
name: item.name,
|
||||
status: item.status,
|
||||
type: 'automation',
|
||||
};
|
||||
});
|
||||
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,
|
||||
};
|
||||
});
|
||||
} catch (err) {
|
||||
if (err instanceof BadRequestException) {
|
||||
throw err; // Re-throw BadRequestException
|
||||
|
Reference in New Issue
Block a user