From 2c953b58da5b6ebef802fbf1396fe2443e8c471b Mon Sep 17 00:00:00 2001 From: santiago Date: Fri, 22 Aug 2025 12:48:25 -0600 Subject: [PATCH] Subir cambios a develop --- src/almacenamiento/almacenamiento.controller.ts | 1 + src/almacenamiento/almacenamiento.service.ts | 6 ++++-- src/almacenamiento/entity/almacenamiento.entity.ts | 1 - src/app.module.ts | 1 - src/auth/auth.controller.ts | 9 ++++++++- .../evento-participante.controller.ts | 7 +++++-- .../evento-participante.service.ts | 4 ++++ src/participante/participante.controller.ts | 12 ++++++++++-- src/participante/participante.service.ts | 4 ++++ 9 files changed, 36 insertions(+), 9 deletions(-) diff --git a/src/almacenamiento/almacenamiento.controller.ts b/src/almacenamiento/almacenamiento.controller.ts index fb8682a..ca25f5d 100644 --- a/src/almacenamiento/almacenamiento.controller.ts +++ b/src/almacenamiento/almacenamiento.controller.ts @@ -7,6 +7,7 @@ export class AlmacenamientoController { @Post() async create(@Body() body: { correo: string; agree: boolean }) { + console.log('Peticion aceptada') if (!body.agree) { return { message: 'User did not agree', data: body }; } diff --git a/src/almacenamiento/almacenamiento.service.ts b/src/almacenamiento/almacenamiento.service.ts index 855eebc..6abbe29 100644 --- a/src/almacenamiento/almacenamiento.service.ts +++ b/src/almacenamiento/almacenamiento.service.ts @@ -12,7 +12,9 @@ export class AlmacenamientoService { // Example method to create a new record async create(correo: string): Promise { - const existente = await this.almacenamientoRepository.findOneBy({ correo }); + console.log(correo) + const existente = await this.almacenamientoRepository.findOne({ where:{correo} }); + console.log(existente) if (!existente) { throw new Error("Este usuario no tiene acceso") } @@ -32,7 +34,7 @@ export class AlmacenamientoService { "Content-Type": "application/json", "Authorization": `Bearer ${process.env.TOKEN}` - }, + }, body: JSON.stringify(entrada) }) console.log(resonse) diff --git a/src/almacenamiento/entity/almacenamiento.entity.ts b/src/almacenamiento/entity/almacenamiento.entity.ts index 1374dd2..a056630 100644 --- a/src/almacenamiento/entity/almacenamiento.entity.ts +++ b/src/almacenamiento/entity/almacenamiento.entity.ts @@ -10,7 +10,6 @@ export class Almacenamiento { @Column('timestamp', { name: 'fecha_ampliacion', - default: () => 'CURRENT_TIMESTAMP', }) fechaConsulta: Date; diff --git a/src/app.module.ts b/src/app.module.ts index d6d5d11..83aaa83 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -133,7 +133,6 @@ import { Almacenamiento } from './almacenamiento/entity/almacenamiento.entity'; ], controllers: [ AppController, - ParticipanteController, InscripcionStatusController, ], providers: [AppService, InscripcionStatusService], diff --git a/src/auth/auth.controller.ts b/src/auth/auth.controller.ts index 8f9ffe8..1e735d9 100644 --- a/src/auth/auth.controller.ts +++ b/src/auth/auth.controller.ts @@ -1,15 +1,17 @@ -import { Body, Controller, Post } from '@nestjs/common'; +import { Body, Controller, Param, Post } from '@nestjs/common'; import { AuthService } from './auth.service'; import { LoginMiembroDto } from './dto/loginMiembro.dto'; import { RegistrarMiembroDto } from './dto/registrarMiembro.dto'; import { ApiTags } from '@nestjs/swagger'; import { ApiPostRegistro } from './auth.docs'; +import { jwtStrategy } from './jwt.strategy'; @Controller('auth') @ApiTags('auth') export class AuthController { constructor( private authService: AuthService, + private authValidar: jwtStrategy, ) /* @InjectRepository(Usuario) private usuarioRepository: Repository */ {} @Post('registro') @@ -22,4 +24,9 @@ export class AuthController { login(@Body() LoginUsuario: LoginMiembroDto) { return this.authService.login(LoginUsuario); } + + @Post('validate') + validar(@Param() token: any) { + return this.authValidar.validate + } } diff --git a/src/evento-participante/evento-participante/evento-participante.controller.ts b/src/evento-participante/evento-participante/evento-participante.controller.ts index 9af94da..09f00c4 100644 --- a/src/evento-participante/evento-participante/evento-participante.controller.ts +++ b/src/evento-participante/evento-participante/evento-participante.controller.ts @@ -1,4 +1,4 @@ -import { Body, Controller, Param, ParseIntPipe, Post } from '@nestjs/common'; +import { Body, Controller, Get, Param, ParseIntPipe, Post } from '@nestjs/common'; import { RegistrarParticipanteDto } from './dto/registrarParticipanteDto.dto'; import { EventoParticipanteService } from './evento-participante.service'; import { EventoParticipante } from './eventoParticipante.entity'; @@ -12,5 +12,8 @@ export class EventoParticipanteController { return this.eventoParticipanteService.registrarParticipante(id, datos) } - + @Get() + getEventoParticipante(): Promise { + return this.eventoParticipanteService.getEventoParticipantes(); + } } diff --git a/src/evento-participante/evento-participante/evento-participante.service.ts b/src/evento-participante/evento-participante/evento-participante.service.ts index c6be9a1..aa4ecf4 100644 --- a/src/evento-participante/evento-participante/evento-participante.service.ts +++ b/src/evento-participante/evento-participante/evento-participante.service.ts @@ -75,4 +75,8 @@ export class EventoParticipanteService { }, ); } + + getEventoParticipantes() { + return this.eventoParticipanteRepository.find() + } } diff --git a/src/participante/participante.controller.ts b/src/participante/participante.controller.ts index eb2ca4f..84e7a96 100644 --- a/src/participante/participante.controller.ts +++ b/src/participante/participante.controller.ts @@ -1,5 +1,13 @@ -import { Controller, Post } from '@nestjs/common'; +import { Controller, Get, Post } from '@nestjs/common'; import { ParticipanteService } from './participante.service'; +import { Participante } from './participante.entity'; @Controller('participante') -export class ParticipanteController {} +export class ParticipanteController { + constructor(private participanteService: ParticipanteService) {} + + @Get() + getParticipantes(): Promise { + return this.participanteService.getParticipantes(); + } +} diff --git a/src/participante/participante.service.ts b/src/participante/participante.service.ts index 1112e1f..f4681ed 100644 --- a/src/participante/participante.service.ts +++ b/src/participante/participante.service.ts @@ -31,4 +31,8 @@ export class ParticipanteService { }, ); } + + getParticipantes() { + return this.participanteRepository.find(); + } }