diff --git a/libs/common/src/dto/pagination.request.dto.ts b/libs/common/src/dto/pagination.request.dto.ts index 4eff373..a2d011f 100644 --- a/libs/common/src/dto/pagination.request.dto.ts +++ b/libs/common/src/dto/pagination.request.dto.ts @@ -2,7 +2,6 @@ import { IsDate, IsOptional } from 'class-validator'; import { IsPageRequestParam } from '../validators/is-page-request-param.validator'; import { ApiProperty } from '@nestjs/swagger'; import { IsSizeRequestParam } from '../validators/is-size-request-param.validator'; -import { IsSortParam } from '../validators/is-sort-param.validator'; import { Transform } from 'class-transformer'; import { parseToDate } from '../util/parseToDate'; @@ -29,18 +28,6 @@ export class PaginationRequestGetListDto { }) size?: number; - @IsOptional() - @IsSortParam({ - message: - 'Incorrect sorting condition format. Should be like this format propertyId:asc,createdDate:desc', - }) - @ApiProperty({ - name: 'sort', - required: false, - description: 'Sort condition', - }) - sort?: string; - @IsOptional() @ApiProperty({ name: 'name', @@ -49,14 +36,6 @@ export class PaginationRequestGetListDto { }) name?: string; - @IsOptional() - @ApiProperty({ - name: 'include', - required: false, - description: 'Fields to include', - }) - include?: string; - @ApiProperty({ name: 'from', required: false, diff --git a/libs/common/src/util/buildTypeORMWhereClause.ts b/libs/common/src/util/buildTypeORMWhereClause.ts index 99119eb..31b55eb 100644 --- a/libs/common/src/util/buildTypeORMWhereClause.ts +++ b/libs/common/src/util/buildTypeORMWhereClause.ts @@ -6,7 +6,6 @@ export function buildTypeORMWhereClause({ where }) { // Remove extra nesting if `where` is wrapped within an additional `where` property const condition = where.where ? where.where : where; - console.log(condition); const convertToNestedObject = (condition: any): any => { const result = {}; for (const [key, value] of Object.entries(condition)) { diff --git a/src/device/controllers/device.controller.ts b/src/device/controllers/device.controller.ts index 398aa4d..5a2fba5 100644 --- a/src/device/controllers/device.controller.ts +++ b/src/device/controllers/device.controller.ts @@ -138,6 +138,7 @@ export class DeviceController { async getAllDevices() { return await this.deviceService.getAllDevices(); } + @ApiBearerAuth() @UseGuards(JwtAuthGuard) @Get('report-logs/:deviceUuid') diff --git a/src/device/interfaces/get.device.interface.ts b/src/device/interfaces/get.device.interface.ts index 93438b9..d003d2d 100644 --- a/src/device/interfaces/get.device.interface.ts +++ b/src/device/interfaces/get.device.interface.ts @@ -1,6 +1,6 @@ export interface GetDeviceDetailsInterface { activeTime: number; - assetId: string; + assetId?: string; category: string; categoryName: string; createTime: number; @@ -13,6 +13,7 @@ export interface GetDeviceDetailsInterface { lon: string; model: string; name: string; + battery?: number; nodeId: string; online: boolean; productId?: string; @@ -23,6 +24,18 @@ export interface GetDeviceDetailsInterface { uuid: string; productType: string; productUuid: string; + spaces?: SpaceInterface[]; + community?: CommunityInterface; +} + +export interface SpaceInterface { + uuid: string; + spaceName: string; +} + +export interface CommunityInterface { + uuid: string; + name: string; } export interface addDeviceInRoomInterface { diff --git a/src/device/services/device.service.ts b/src/device/services/device.service.ts index 46a820e..09b905c 100644 --- a/src/device/services/device.service.ts +++ b/src/device/services/device.service.ts @@ -614,12 +614,12 @@ export class DeviceService { } } async getDevicesInstructionStatus(deviceUuid: string) { - const deviceDetails = await this.getDeviceByDeviceUuid(deviceUuid); - - if (!deviceDetails) { - throw new NotFoundException('Device Not Found'); - } try { + const deviceDetails = await this.getDeviceByDeviceUuid(deviceUuid); + + if (!deviceDetails) { + throw new NotFoundException('Device Not Found'); + } const deviceStatus = await this.getDevicesInstructionStatusTuya( deviceDetails.deviceTuyaUuid, ); @@ -902,12 +902,12 @@ export class DeviceService { name: device.spaceDevice.community.name, }, // permissionType: device.permission[0].permissionType.type, - /* ...(await this.getDeviceDetailsByDeviceIdTuya( + ...(await this.getDeviceDetailsByDeviceIdTuya( device.deviceTuyaUuid, - )),*/ + )), uuid: device.uuid, ...(battery && { battery }), - }; + } as GetDeviceDetailsInterface; }), );