Skip to content

Commit

Permalink
fix(modules/statistics/dtos): ItemQuery fix number params
Browse files Browse the repository at this point in the history
  • Loading branch information
Mnigos committed Dec 5, 2023
1 parent fb07fee commit ac265b7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/modules/statistics/dtos/item-query.dto.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { IsOptional } from 'class-validator'
import { Transform } from 'class-transformer'
import { IsNumber, IsOptional, Max } from 'class-validator'

export abstract class ItemQuery {
@IsOptional()
@IsNumber()
@Max(50)
@Transform(({ value }) => Number(value))
limit?: number
}
2 changes: 2 additions & 0 deletions src/modules/statistics/dtos/top-item-query.dto.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { IsEnum, IsNumber, IsOptional } from 'class-validator'
import { Transform } from 'class-transformer'

import { TimeRange } from '../enums'

Expand All @@ -11,5 +12,6 @@ export abstract class TopItemQuery extends ItemQuery {

@IsOptional()
@IsNumber()
@Transform(({ value }) => Number(value))
offset?: number
}

0 comments on commit ac265b7

Please sign in to comment.