Skip to content

Commit

Permalink
Add transform decorator to limit the size property of PaignationQuery…
Browse files Browse the repository at this point in the history
… to 60. (#300)
  • Loading branch information
aikchun authored Aug 3, 2021
1 parent 27701ad commit 9116800
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions apps/whale/src/module.api/_core/api.query.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { IsInt, IsOptional, IsString, Max, Min } from 'class-validator'
import { Type } from 'class-transformer'
import { IsInt, IsOptional, IsString, Min } from 'class-validator'
import { Type, Transform } from 'class-transformer'

/**
* Pagination query with
Expand All @@ -11,8 +11,8 @@ import { Type } from 'class-transformer'
export class PaginationQuery {
@IsOptional()
@IsInt()
@Transform(({ value }) => value > 60 ? 60 : value)
@Min(0)
@Max(60)
@Type(() => Number)
size: number = 30

Expand Down

0 comments on commit 9116800

Please sign in to comment.