import { IsEnum, IsOptional, IsString, IsBoolean, IsNumber, } from 'class-validator'; import { video_situation } from 'generated/prisma'; import { Transform } from 'class-transformer'; export class ListVideosQueryDto { @IsEnum(video_situation) @IsOptional() @Transform( ({ value }: { value: string }) => value?.toUpperCase() as video_situation, ) situation?: video_situation; @IsString() @IsOptional() title?: string; @IsNumber() @IsOptional() @Transform(({ value }) => (value ? Number(value) : 1)) page?: number; @IsNumber() @IsOptional() @Transform(({ value }) => (value ? Number(value) : 10)) perPage?: number = 10; @IsOptional() direction: 'asc' | 'desc' = 'desc'; @Transform(({ value }) => value !== 'false') @IsBoolean() @IsOptional() pageable: boolean = true; }