mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-14 09:57:28 +00:00
removed unit,floor,building,room modules
This commit is contained in:
@ -10,7 +10,6 @@ import {
|
||||
UpdateAutomationDto,
|
||||
UpdateAutomationStatusDto,
|
||||
} from '../dtos';
|
||||
import { GetUnitByUuidInterface } from 'src/unit/interface/unit.interface';
|
||||
import { ConfigService } from '@nestjs/config';
|
||||
import { TuyaContext } from '@tuya/tuya-connector-nodejs';
|
||||
import { convertKeysToSnakeCase } from '@app/common/helper/snakeCaseConverter';
|
||||
@ -23,7 +22,6 @@ import {
|
||||
GetAutomationByUnitInterface,
|
||||
} from '../interface/automation.interface';
|
||||
import { convertKeysToCamelCase } from '@app/common/helper/camelCaseConverter';
|
||||
import { SpaceType } from '@app/common/constants/space-type.enum';
|
||||
import {
|
||||
ActionExecutorEnum,
|
||||
EntityTypeEnum,
|
||||
@ -126,18 +124,14 @@ export class AutomationService {
|
||||
}
|
||||
}
|
||||
}
|
||||
async getUnitByUuid(unitUuid: string): Promise<GetUnitByUuidInterface> {
|
||||
async getUnitByUuid(unitUuid: string) {
|
||||
try {
|
||||
const unit = await this.spaceRepository.findOne({
|
||||
where: {
|
||||
uuid: unitUuid,
|
||||
spaceType: {
|
||||
type: SpaceType.UNIT,
|
||||
},
|
||||
},
|
||||
relations: ['spaceType'],
|
||||
});
|
||||
if (!unit || !unit.spaceType || unit.spaceType.type !== SpaceType.UNIT) {
|
||||
if (!unit) {
|
||||
throw new BadRequestException('Invalid unit UUID');
|
||||
}
|
||||
return {
|
||||
@ -145,7 +139,6 @@ export class AutomationService {
|
||||
createdAt: unit.createdAt,
|
||||
updatedAt: unit.updatedAt,
|
||||
name: unit.spaceName,
|
||||
type: unit.spaceType.type,
|
||||
spaceTuyaUuid: unit.spaceTuyaUuid,
|
||||
};
|
||||
} catch (err) {
|
||||
|
Reference in New Issue
Block a user