### File

`src/core/domain/dtos/search-result.dto.ts`

### Description

Elasticsearch response DTO

### Index

###### Properties

- data
- statusCode

### Constructor

`constructor(code: number, data: EsResponseDto)`
Defined in src/core/domain/dtos/search-result.dto.ts:42

Constructs an object with provided parameters

Parameters :

Name | Type | Optional
code | `number` | No
data | `EsResponseDto` | No

### Properties

data
Type : `EsResponseDto`
Decorators : `@IsDefined() @IsNotEmpty() @IsArray() @ApiProperty({description: 'Data acquired from the Elasticsearch', example: undefined})`
Defined in src/core/domain/dtos/search-result.dto.ts:42
All the data acquired.

statusCode
Type : `number`
Decorators : `@IsDefined() @IsNotEmpty() @IsInt() @ApiProperty({description: 'Status code', example: 200})`
Defined in src/core/domain/dtos/search-result.dto.ts:25
Status code

    import { ApiExtraModels, ApiProperty } from "@nestjs/swagger";
    import { IsArray, IsDefined, IsInt, IsNotEmpty } from "class-validator";
    import { EsResponseDto } from "./elastic/es-response.dto";

    /**
     * List of allowed properties in this DTO
     */
    const allowedProperties = ['data', 'status'];

    /**
     * Elasticsearch response DTO
     */
    @ApiExtraModels()
    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: {
                took: 1,
                timed_out: false,
                _shards: {},
                hits: {}
            },
        })
        data: EsResponseDto;

        /**
         * Constructs an object with provided parameters
         * @param code
         * @param data
         */
        constructor(code: number, data: EsResponseDto) {
            this.statusCode = code;
            this.data = data;
        }
    }

# results matching ""

# No results matching ""