get saldo by dbAT

This commit is contained in:
2025-10-24 16:39:01 -06:00
parent 840887c97d
commit b5bd666934
2 changed files with 13 additions and 10 deletions
@@ -44,8 +44,6 @@ export class GoogleStrategy extends PassportStrategy(Strategy, 'google') {
): Promise<any> {
try {
const email = profile.emails?.[0]?.value || '';
const nombre = profile.name?.givenName || '';
const apellido = profile.name?.familyName || '';
const user = await this.personaService.validateOrCreateGoogleUser({
email,
@@ -11,7 +11,7 @@ export class PersonaService {
@InjectRepository(Persona, 'dbMonedero')
private readonly personaRepository: Repository<Persona>,
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;
}