Ver Fonte

feat(stats-reporting): add validation and transformation decorators for fromSec and toSec in BaseRangeQueryDto

Dave há 1 mês atrás
pai
commit
492aaeef48

+ 6 - 0
apps/box-stats-api/src/feature/stats-reporting/dto/stats-reporting.dto.ts

@@ -1,16 +1,22 @@
 import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
+import { Type } from 'class-transformer';
+import { IsInt } from 'class-validator';
 
 export class BaseRangeQueryDto {
   @ApiProperty({
     description: 'UTC epoch seconds (inclusive)',
     example: 1767168000,
   })
+  @Type(() => Number)
+  @IsInt()
   fromSec!: number;
 
   @ApiProperty({
     description: 'UTC epoch seconds (exclusive)',
     example: 1767175200,
   })
+  @Type(() => Number)
+  @IsInt()
   toSec!: number;
 
   @ApiPropertyOptional({