mirror of
https://github.com/ershisan99/flashcards-api.git
synced 2025-12-17 12:33:22 +00:00
add decks crud
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
export const DEFAULT_PAGE_SIZE = 10
|
||||
export const DEFAULT_PAGE_NUMBER = 1
|
||||
14
src/infrastructure/common/pagination/pagination.dto.ts
Normal file
14
src/infrastructure/common/pagination/pagination.dto.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { IsNumber, IsOptional } from 'class-validator'
|
||||
import { Type } from 'class-transformer'
|
||||
|
||||
export class PaginationDto {
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsNumber()
|
||||
currentPage?: number
|
||||
|
||||
@Type(() => Number)
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
pageSize?: number
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import { ValidateIf, ValidationOptions } from 'class-validator'
|
||||
|
||||
export function IsOptionalOrEmptyString(validationOptions?: ValidationOptions) {
|
||||
return ValidateIf((obj, value) => {
|
||||
return value !== null && value !== undefined && value !== ''
|
||||
}, validationOptions)
|
||||
}
|
||||
Reference in New Issue
Block a user