removed unit,floor,building,room modules

This commit is contained in:
hannathkadher
2024-10-22 10:02:54 +04:00
parent 581618296d
commit 3bd18c2b29
53 changed files with 110 additions and 2416 deletions

View File

@ -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) {