src/user/dtos/filtered-users.dto.ts
Properties |
Accessors |
Readonly Optional limit |
Type : number
|
Default value : 10
|
Decorators :
@ApiPropertyOptional({minimum: 1, maximum: 1000, default: 10, type: 'integer'})
|
Defined in src/user/dtos/filtered-users.dto.ts:36
|
Readonly Optional page |
Type : number
|
Default value : 1
|
Decorators :
@ApiPropertyOptional({minimum: 1, default: 1, type: 'integer'})
|
Defined in src/user/dtos/filtered-users.dto.ts:15
|
Readonly username |
Type : string
|
Default value : ""
|
Decorators :
@ApiProperty({description: 'Username search query to filter from the list of users', type: 'string'})
|
Defined in src/user/dtos/filtered-users.dto.ts:23
|
skip |
getskip()
|
Defined in src/user/dtos/filtered-users.dto.ts:38
|
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
import { Type } from "class-transformer";
import { IsInt, Min, IsOptional, Max, MinLength } from "class-validator";
export class FilteredUsersDto {
@ApiPropertyOptional({
minimum: 1,
default: 1,
type: "integer",
})
@Type(() => Number)
@IsInt()
@Min(1)
@IsOptional()
readonly page?: number = 1;
@ApiProperty({
description: "Username search query to filter from the list of users",
type: "string",
})
@MinLength(3)
@Type(() => String)
readonly username: string = "";
@ApiPropertyOptional({
minimum: 1,
maximum: 1000,
default: 10,
type: "integer",
})
@Type(() => Number)
@IsInt()
@Min(1)
@Max(100)
@IsOptional()
readonly limit?: number = 10;
get skip(): number {
return ((this.page ?? 1) - 1) * (this.limit ?? 10);
}
}