File

src/user/dtos/filtered-users.dto.ts

Index

Properties
Accessors

Properties

Readonly Optional limit
Type : number
Default value : 10
Decorators :
@ApiPropertyOptional({minimum: 1, maximum: 1000, default: 10, type: 'integer'})
@Type(undefined)
@IsInt()
@Min(1)
@Max(100)
@IsOptional()
Readonly Optional page
Type : number
Default value : 1
Decorators :
@ApiPropertyOptional({minimum: 1, default: 1, type: 'integer'})
@Type(undefined)
@IsInt()
@Min(1)
@IsOptional()
Readonly username
Type : string
Default value : ""
Decorators :
@ApiProperty({description: 'Username search query to filter from the list of users', type: 'string'})
@MinLength(3)
@Type(undefined)

Accessors

skip
getskip()
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);
  }
}

results matching ""

    No results matching ""