Corrige paginacao e adiciona endpoint de busca e delecao
This commit is contained in:
40
src/videos/dto/list-videos-query.dto.ts
Normal file
40
src/videos/dto/list-videos-query.dto.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user