From b5bd666934a8281a91e3611bd02374819c7ada3c Mon Sep 17 00:00:00 2001 From: IO420 <320154041@pcpuma.acatlan.unam.mx> Date: Fri, 24 Oct 2025 16:39:01 -0600 Subject: [PATCH] get saldo by dbAT --- .../Monedero/persona/google.strategy.ts | 2 -- .../Monedero/persona/persona.service.ts | 21 ++++++++++++------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/modules/Monedero/persona/google.strategy.ts b/src/modules/Monedero/persona/google.strategy.ts index 0b510e9..21c0825 100644 --- a/src/modules/Monedero/persona/google.strategy.ts +++ b/src/modules/Monedero/persona/google.strategy.ts @@ -44,8 +44,6 @@ export class GoogleStrategy extends PassportStrategy(Strategy, 'google') { ): Promise { try { const email = profile.emails?.[0]?.value || ''; - const nombre = profile.name?.givenName || ''; - const apellido = profile.name?.familyName || ''; const user = await this.personaService.validateOrCreateGoogleUser({ email, diff --git a/src/modules/Monedero/persona/persona.service.ts b/src/modules/Monedero/persona/persona.service.ts index 4720e75..21ef73a 100644 --- a/src/modules/Monedero/persona/persona.service.ts +++ b/src/modules/Monedero/persona/persona.service.ts @@ -11,7 +11,7 @@ export class PersonaService { @InjectRepository(Persona, 'dbMonedero') private readonly personaRepository: Repository, private readonly jwtService: JwtService, - + //AT private readonly alumnoService: AlumnoService, ) {} @@ -56,13 +56,13 @@ export class PersonaService { async validateOrCreateGoogleUser(data: { email: string }) { let persona = await this.findByEmail(data.email); + const numeroIdentificar = data.email.split('@')[0]; + + const alum = await this.alumnoService.findOneById( + Number(numeroIdentificar), + ); + if (!persona) { - const numeroIdentificar = data.email.split('@')[0]; - - const alum = await this.alumnoService.findOneById( - Number(numeroIdentificar), - ); - const apellidoArray = alum.nombre.split(' '); const apellidoP = apellidoArray[0] || ''; @@ -77,7 +77,7 @@ export class PersonaService { tipo = 'Academico'; } - persona = await this.create({ + persona = await this.personaRepository.create({ nombre, apellidoP, apellidoM, @@ -94,8 +94,13 @@ export class PersonaService { cambioPasswordReq: true, primerLogin: false, }); + } else { + const monto = this.alumnoService.GetCredit(Number(persona.idPersona)); + + persona.cantidadCuenta = await monto; } + await this.personaRepository.save(persona); return persona; }