src/core/domain/dtos/request.dto.ts
Request object, which contains query parameters and Elasticsearch query object
Properties |
constructor(query: SearchQueryDto, es_query: EsQueryDto)
|
|||||||||
Defined in src/core/domain/dtos/request.dto.ts:37
|
|||||||||
Constructs an object with provided parameters
Parameters :
|
Optional es_query |
Type : EsQueryDto
|
Decorators :
@IsOptional()
|
Defined in src/core/domain/dtos/request.dto.ts:37
|
Elasticsearch query object |
query |
Type : SearchQueryDto
|
Decorators :
@IsDefined()
|
Defined in src/core/domain/dtos/request.dto.ts:26
|
Query parameters object |
import { ApiExtraModels, ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
import { IsDefined, IsNotEmpty, IsOptional } from "class-validator";
import { EsQueryDto } from "./elastic/es-query.dto";
import { SearchQueryDto } from "./search-q.dto";
/**
* List of allowed properties in this DTO
*/
const allowedProperties = ['query', 'es_query'];
/**
* Request object, which contains query parameters and Elasticsearch query object
*/
@ApiExtraModels()
export class RequestDto {
/**
* Query parameters object
*/
@IsDefined()
@IsNotEmpty()
@ApiProperty({
type: SearchQueryDto,
description: 'Actual query with parameters acquired from the request',
example: {}
})
query: SearchQueryDto;
/**
* Elasticsearch query object
*/
@IsOptional()
@ApiPropertyOptional({
type: EsQueryDto,
description: 'Elasticsearch query body constructed by pagination mechanism',
example: {},
})
es_query?: EsQueryDto;
/**
* Constructs an object with provided parameters
* @param query
* @param es_query
*/
constructor(query: SearchQueryDto, es_query: EsQueryDto) {
this.query = query;
this.es_query = es_query;
}
}