import { ApiExtraModels, ApiProperty } from "@nestjs/swagger"; import { IsArray, IsDefined, IsIn, IsInt, IsNotEmpty, IsOptional, IsString } from "class-validator"; /** * List of allowed properties in this DTO */ const allowedProperties = ['id', 'title', 'authors', 'topic', 'summary', 'tags', 'content']; /** * Structure of the document stored and retrieved from Elasticsearch */ @ApiExtraModels() export class PaperDto { /** * Unique ID of the paper */ @IsNotEmpty() @IsString() @ApiProperty({ description: 'Unique ID of the paper', example: 'cc3c3cca-f763-495c-8dfa-69c45ca738ff' }) id: string; /** * Title of the paper */ @IsNotEmpty() @IsString() @ApiProperty({ description: 'Title of the paper', example: 'Mucosal associated invariant T cell', }) title: string; /** * List of authors of the paper */ @IsNotEmpty() @IsArray() @ApiProperty({ description: 'List of authors of the paper', example: ['Daniil Mikhaylov', 'Denis Gorbunov', 'Maxim Ten'] }) authors: string[]; /** * Topic of the paper */ @IsNotEmpty() @IsString() @ApiProperty({ description: 'Topic of the paper', example: 'Physics' }) topic: string; /** * Summary of the paper. May be a short excerpt from the main text. */ @IsNotEmpty() @IsString() @ApiProperty({ description: 'Summary of the paper. May be a short excerpt from the main text', example: 'S-algol (St Andrews Algol):vii is a computer programming language derivative of ALGOL 60 developed at the University of St Andrews in 1979 by Ron Morrison and Tony Davie' }) summary: string; /** * List of tags, that show the certain topics/fields of knowledge paper is touching */ @IsNotEmpty() @IsArray() @ApiProperty({ description: 'List of tags, that show the certain topics/fields of knowledge paper is touching', example: ['Neurobiology', 'Neuron structure', 'Neuroimaging'] }) tags: string[]; /** * Contents of the paper [Markdown] */ @ApiProperty({ description: 'Contents of the paper presented in Markdown (.md) format', example: '...' }) content: string; }