69 lines
1.7 KiB
TypeScript
69 lines
1.7 KiB
TypeScript
import { applyDecorators } from '@nestjs/common';
|
|
import {
|
|
ApiTags,
|
|
ApiOperation,
|
|
ApiBody,
|
|
ApiParam,
|
|
ApiConsumes,
|
|
} from '@nestjs/swagger';
|
|
import { CreateEventoDto } from '../dto/create-evento.dto';
|
|
import { UpdateEventoDto } from '../dto/update.evento.dto';
|
|
import {
|
|
actualizacionEventoNombreYFechas,
|
|
actualizacionEventoTipo,
|
|
ejemploEventoAcademico,
|
|
ejemploEventoCultural,
|
|
ejemploFeriaSexualidad,
|
|
} from './evento.examples';
|
|
|
|
export class EventoApiDocumentation {
|
|
static ApiController = ApiTags('Evento');
|
|
|
|
static ApiCreate = applyDecorators(
|
|
ApiOperation({ summary: 'Crear un nuevo evento' }),
|
|
ApiBody({
|
|
type: CreateEventoDto,
|
|
examples: {
|
|
ejemplo1: ejemploFeriaSexualidad,
|
|
ejemplo2: ejemploEventoAcademico,
|
|
ejemplo3: ejemploEventoCultural,
|
|
},
|
|
}),
|
|
);
|
|
|
|
static ApiUpdate = applyDecorators(
|
|
ApiOperation({ summary: 'Actualizar un evento existente por ID' }),
|
|
ApiBody({
|
|
type: UpdateEventoDto,
|
|
examples: {
|
|
actualizacion1: actualizacionEventoNombreYFechas,
|
|
actualizacion2: actualizacionEventoTipo,
|
|
},
|
|
}),
|
|
);
|
|
|
|
static ApiPostBanner = applyDecorators(
|
|
ApiOperation({ summary: 'Subir banner para un evento' }),
|
|
ApiParam({
|
|
name: 'id',
|
|
type: Number,
|
|
description: 'ID del evento al que se asigna el banner',
|
|
}),
|
|
ApiConsumes('multipart/form-data'),
|
|
ApiBody({
|
|
schema: {
|
|
type: 'object',
|
|
properties: {
|
|
banner: {
|
|
type: 'string',
|
|
format: 'binary',
|
|
description:
|
|
'Archivo de imagen (jpg, png, webp) que será el banner del evento',
|
|
},
|
|
},
|
|
required: ['banner'],
|
|
},
|
|
}),
|
|
);
|
|
}
|