mirror of
https://github.com/SyncrowIOT/backend.git
synced 2026-10-25 13:17:55 +00:00
Add query parameter to filter spaces with devices
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import { BooleanValues } from '@app/common/constants/boolean-values.enum';
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { Transform } from 'class-transformer';
|
||||
import { IsBoolean, IsOptional } from 'class-validator';
|
||||
|
||||
export class GetSpaceDto {
|
||||
@ApiProperty({
|
||||
example: true,
|
||||
description: 'Only return spaces with devices',
|
||||
required: false,
|
||||
default: false,
|
||||
})
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
@Transform((value) => {
|
||||
return value.obj.onlyWithDevices === BooleanValues.TRUE;
|
||||
})
|
||||
public onlyWithDevices?: boolean = false;
|
||||
}
|
||||
Reference in New Issue
Block a user