src/core/domain/dtos/search-result.dto.ts
Elasticsearch response DTO
Properties |
constructor(code: number, data: object)
|
Defined in src/core/domain/dtos/search-result.dto.ts:37
|
Constructs an object with provided parameters |
data |
Type : object
|
Decorators :
@IsDefined()
|
Defined in src/core/domain/dtos/search-result.dto.ts:37
|
All the data acquired. |
statusCode |
Type : number
|
Decorators :
@IsDefined()
|
Defined in src/core/domain/dtos/search-result.dto.ts:23
|
Status code |
import { ApiProperty } from "@nestjs/swagger";
import { IsArray, IsDefined, IsInt, IsNotEmpty, IsOptional, IsString } from "class-validator";
/**
* List of allowed properties in this DTO
*/
const allowedProperties = ['data', 'status'];
/**
* Elasticsearch response DTO
*/
export class SearchResultDto {
/**
* Status code
*/
@IsDefined()
@IsNotEmpty()
@IsInt()
@ApiProperty({
description: 'Status code',
example: 200,
})
statusCode: number;
/**
* All the data acquired.
*/
@IsDefined()
@IsNotEmpty()
@IsArray()
@ApiProperty({
description: 'Data acquired from the Elasticsearch',
example: {
},
})
data: object;
/**
* Constructs an object with provided parameters
* @param code
* @param data
*/
constructor(code: number, data: object) {
this.statusCode = code;
this.data = data;
}
}