30 lines
520 B
TypeScript
30 lines
520 B
TypeScript
import { Type } from 'class-transformer';
|
|
import { IsInt, IsOptional, Max, Min } from 'class-validator';
|
|
|
|
export class PaginatedQueryDto {
|
|
@IsOptional()
|
|
@Type(() => Number)
|
|
@IsInt()
|
|
@Min(1)
|
|
page: number = 1;
|
|
|
|
@IsOptional()
|
|
@Type(() => Number)
|
|
@IsInt()
|
|
@Min(1)
|
|
@Max(100)
|
|
perPage: number = 20;
|
|
}
|
|
|
|
export type PaginatedResponse<T> = {
|
|
content: T[];
|
|
pagination: {
|
|
page: number;
|
|
perPage: number;
|
|
total: number;
|
|
totalPages: number;
|
|
hasNext: boolean;
|
|
hasPrev: boolean;
|
|
};
|
|
};
|