Corrige paginacao e adiciona endpoint de busca e delecao

This commit is contained in:
LeoMortari
2025-09-27 18:39:17 -03:00
parent 33f12b4f83
commit 76b7670fba
5 changed files with 193 additions and 32 deletions

View 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;
}