Muchos cambios

This commit is contained in:
JorgeMike
2023-06-26 08:33:18 -06:00
parent 0a70bf2af2
commit e2afc63e28
13 changed files with 184 additions and 170 deletions
+8 -2
View File
@@ -1,4 +1,4 @@
import { Body, Controller, Delete, Get, Param, ParseIntPipe, Patch, Post, Res } from '@nestjs/common';
import { Body, Controller, Delete, Get, Param, ParseIntPipe, Patch, Post, Res, UseGuards } from '@nestjs/common';
import { Response } from 'express';
import { InjectRepository } from '@nestjs/typeorm';
import { EventoParticipante } from 'src/evento-participante/evento-participante/eventoParticipante.entity';
@@ -7,6 +7,7 @@ import { actualizarEventoDto } from './dto/actualizarEvento.dto';
import { crearEventoDto } from './dto/crearEvento.dto';
import { Evento } from './evento.entity';
import { EventosService } from './eventos.service';
import { AuthGuard } from '@nestjs/passport';
@Controller('eventos')
export class EventosController {
@@ -23,16 +24,19 @@ export class EventosController {
return this.eventoService.getEventosPorId(id)
}
@UseGuards(AuthGuard('jwt'))
@Post()
postEvento(@Body() nuevoEvento: crearEventoDto){
return this.eventoService.postEvento(nuevoEvento)
}
@UseGuards(AuthGuard('jwt'))
@Patch(':id')
patchEvento(@Param('id', ParseIntPipe)id:number, @Body() actualizacion: actualizarEventoDto){
return this.eventoService.updateEvento(id,actualizacion)
}
@UseGuards(AuthGuard('jwt'))
@Delete(':id')
deleteEvento(@Param('id', ParseIntPipe)id: number){
return this.eventoService.deleteEventoParticipante(id)
@@ -43,11 +47,13 @@ export class EventosController {
return this.eventoService.getCupos(id)
}
@UseGuards(AuthGuard('jwt'))
@Get(':id/participante')
async getParticipnates(@Param('id', ParseIntPipe)id:number){
return this.eventoService.getParticipantes(id)
}
@UseGuards(AuthGuard('jwt'))
@Get(':id/exportExcel')
async exportarExcel (@Param('id', ParseIntPipe)id:number ,@Res() res: Response){
this.eventoService.exportarParticipantes(id, res)