|
1 |
| -import { IsOptional, IsString, IsNumber, IsIn, IsEnum } from 'class-validator'; |
| 1 | +import { |
| 2 | + IsOptional, |
| 3 | + IsString, |
| 4 | + IsNumber, |
| 5 | + IsIn, |
| 6 | + IsEnum, |
| 7 | + ValidateNested, |
| 8 | +} from 'class-validator'; |
2 | 9 | import { ApiProperty } from '@nestjs/swagger';
|
3 | 10 | import { SupplyPriority } from 'src/supply/types';
|
4 | 11 | import { Transform } from 'class-transformer';
|
@@ -72,4 +79,47 @@ export class ShelterQueryDTO {
|
72 | 79 | @IsOptional()
|
73 | 80 | @IsIn(['available', 'unavailable', 'waiting'], { each: true })
|
74 | 81 | readonly shelterStatus?: ShelterStatus[];
|
| 82 | + |
| 83 | + @ApiProperty({ |
| 84 | + required: false, |
| 85 | + description: 'Informação sobre tags do abrigo', |
| 86 | + }) |
| 87 | + @IsOptional() |
| 88 | + @ValidateNested() |
| 89 | + readonly tags?: Record< |
| 90 | + 'NeedVolunteers' | 'NeedDonations' | 'RemainingSupplies', |
| 91 | + number | undefined |
| 92 | + >; |
| 93 | + |
| 94 | + @ApiProperty({ required: false, description: 'Lista de cidades' }) |
| 95 | + @IsOptional() |
| 96 | + @IsString({ each: true }) |
| 97 | + readonly cities?: string[]; |
| 98 | + |
| 99 | + @ApiProperty({ |
| 100 | + required: false, |
| 101 | + description: 'Latitude', |
| 102 | + }) |
| 103 | + @IsOptional() |
| 104 | + @IsNumber() |
| 105 | + @Transform((value) => Number(value.value)) |
| 106 | + readonly latitude?: number; |
| 107 | + |
| 108 | + @ApiProperty({ |
| 109 | + required: false, |
| 110 | + description: 'Longitude', |
| 111 | + }) |
| 112 | + @IsOptional() |
| 113 | + @IsNumber() |
| 114 | + @Transform((value) => Number(value.value)) |
| 115 | + readonly longitude?: number; |
| 116 | + |
| 117 | + @ApiProperty({ |
| 118 | + required: false, |
| 119 | + description: 'Raio em metros', |
| 120 | + }) |
| 121 | + @IsOptional() |
| 122 | + @IsNumber() |
| 123 | + @Transform((value) => Number(value.value)) |
| 124 | + readonly radiusInMeters?: number; |
75 | 125 | }
|
0 commit comments