se creo el servicio para guardar participantes

This commit is contained in:
2023-02-16 16:49:52 -06:00
parent bc84b7d63d
commit acf2bb3856
25 changed files with 1488 additions and 356 deletions
+36
View File
@@ -0,0 +1,36 @@
import { Body, Controller, Delete, Get, Param, ParseIntPipe, Patch, Post } from '@nestjs/common';
import { actualizarEventoDto } from './dto/actualizarEvento.dto';
import { crearEventoDto } from './dto/crearEvento.dto';
import { Evento } from './evento.entity';
import { EventosService } from './eventos.service';
@Controller('eventos')
export class EventosController {
constructor(private readonly eventoService: EventosService){}
@Get()
getEventos(): Promise<Evento[]>{
return this.eventoService.getEventos()
}
@Get(':id')
getEventosPorId(@Param('id', ParseIntPipe)id: number):Promise<Evento>{
return this.eventoService.getEventosPorId(id)
}
@Post()
postEvento(@Body() nuevoEvento: crearEventoDto): Promise<Evento>{
return this.eventoService.postEvento(nuevoEvento)
}
@Patch(':id')
patchEvento(@Param('id', ParseIntPipe)id:number, @Body() actualizacion: actualizarEventoDto){
return this.eventoService.updateEvento(id,actualizacion)
}
@Delete(':id')
deleteEvento(@Param('id', ParseIntPipe)id: number){
return this.eventoService.deleteEvento(id)
}
}