From 92851b240a0f011e6d1ac873d1a2f222fccca460 Mon Sep 17 00:00:00 2001 From: jorge miguel Date: Tue, 9 Sep 2025 18:03:59 -0600 Subject: [PATCH] feat: add endpoint to register participant attendance without token --- .../participante_evento.controller.ts | 29 +++++++++++++++++++ .../participante_evento.service.ts | 3 +- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/participante_evento/participante_evento.controller.ts b/src/participante_evento/participante_evento.controller.ts index bc450cb..8343ea9 100644 --- a/src/participante_evento/participante_evento.controller.ts +++ b/src/participante_evento/participante_evento.controller.ts @@ -233,12 +233,41 @@ export class ParticipanteEventoController { ); } + @ApiOperation({ + summary: 'Registrar asistencia de un participante a un evento', + }) + @ApiParam({ + name: 'idParticipante', + description: 'ID del participante', + type: 'number', + }) + @ApiParam({ name: 'idEvento', description: 'ID del evento', type: 'number' }) + @ApiResponse({ + status: 200, + description: 'Asistencia registrada correctamente', + }) + @ApiResponse({ status: 404, description: 'Registro no encontrado' }) + @Post('asistencia/:idParticipante/:idEvento') + registrarAsistenciaSinToken( + @Param('idParticipante', ParseIntPipe) idParticipante: number, + @Param('idEvento', ParseIntPipe) idEvento: number, + ) { + return this.participanteEventoService.registrarAsistenciaSinToken( + idParticipante, + idEvento, + ); + } + + @ApiOperation({ + summary: 'Retornala info del token QR', + }) @Post('decode-token') decodeToken(@Body() body: { token: string }) { return this.participanteEventoService.validToken( body.token, ); } + @ApiOperation({ summary: 'Registrar asistencia usando token QR', }) diff --git a/src/participante_evento/participante_evento.service.ts b/src/participante_evento/participante_evento.service.ts index cbb2dab..548e2e6 100644 --- a/src/participante_evento/participante_evento.service.ts +++ b/src/participante_evento/participante_evento.service.ts @@ -160,10 +160,9 @@ export class ParticipanteEventoService { return this.participanteEventoRepository.save(participante_evento); } - async registrarAsistencia( + async registrarAsistenciaSinToken( id_participante: number, id_cuestionario: number, - token: string, ) { const participante_eventoFound = await this.participanteEventoRepository.findOne({