src/core/domain/dtos/search-q.dto.ts
Elasticsearch response DTO
Properties |
constructor(query: string, page: number, limit: number, order: string)
|
Defined in src/core/domain/dtos/search-q.dto.ts:59
|
Constructs an object with provided parameters |
limit |
Type : number
|
Decorators :
@IsOptional()
|
Defined in src/core/domain/dtos/search-q.dto.ts:48
|
Limits the number of displayed elements. |
order |
Type : string
|
Decorators :
@IsOptional()
|
Defined in src/core/domain/dtos/search-q.dto.ts:59
|
Limits the number of displayed elements. |
page |
Type : number
|
Decorators :
@IsDefined()
|
Defined in src/core/domain/dtos/search-q.dto.ts:37
|
Page number to display. |
query |
Type : string
|
Decorators :
@IsDefined()
|
Defined in src/core/domain/dtos/search-q.dto.ts:25
|
Given query string to perform the search on. |
import { ApiExtraModels, ApiProperty } from "@nestjs/swagger";
import { IsDefined, IsInt, IsNotEmpty, IsOptional, IsString } from "class-validator";
/**
* List of allowed properties in this DTO
*/
const allowedProperties = ['query', 'pagen', 'limit', 'order'];
/**
* Elasticsearch response DTO
*/
@ApiExtraModels()
export class SearchQueryDto {
/**
* Given query string to perform the
* search on.
*/
@IsDefined()
@IsNotEmpty()
@IsString()
@ApiProperty({
description: 'query',
example: 'Particle Accelerator'
})
query: string;
/**
* Page number to display.
*/
@IsDefined()
@IsNotEmpty()
@IsInt()
@ApiProperty({
description: 'page',
example: 3,
})
page: number;
/**
* Limits the number of displayed elements.
*/
@IsOptional()
@IsInt()
@ApiProperty({
description: 'limit',
example: 10,
})
limit: number;
/**
* Limits the number of displayed elements.
*/
@IsOptional()
@IsString()
@ApiProperty({
description: 'order',
example: 'asc',
})
order: string;
/**
* Constructs an object with provided parameters
* @param query
* @param page
* @param limit
* @param order
*/
constructor(query: string, page: number, limit: number, order: string) {
this.query = query;
this.page = page;
this.limit = limit;
this.order = order;
}
}