Skip to content

Commit b165c79

Browse files
committed
chore: add restriction to pagination query input
1 parent 15bef84 commit b165c79

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/cafe/dto/req/pagination.dto.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { ApiProperty } from '@nestjs/swagger';
22
import { Type } from 'class-transformer';
3-
import { IsNumber, IsOptional } from 'class-validator';
3+
import { IsNumber, IsOptional, Max, Min } from 'class-validator';
44

55
export class PaginationDto {
66
@ApiProperty({
@@ -9,6 +9,7 @@ export class PaginationDto {
99
required: false,
1010
})
1111
@IsNumber()
12+
@Min(1)
1213
@IsOptional()
1314
@Type(() => Number)
1415
page: number = 1;
@@ -18,6 +19,8 @@ export class PaginationDto {
1819
description: 'Number of pages to get(default: 20)',
1920
required: false,
2021
})
22+
@Min(1)
23+
@Max(1)
2124
@IsNumber()
2225
@IsOptional()
2326
@Type(() => Number)

0 commit comments

Comments
 (0)