Correccion en la validacion del participante evento
This commit is contained in:
@@ -229,8 +229,10 @@ export class ParticipanteEventoService {
|
||||
|
||||
// Verificar si ya había registrado asistencia
|
||||
if (participanteEvento.asistio && participanteEvento.fecha_asistencia) {
|
||||
//Borarr
|
||||
console.log("Usuario se registro exitosamente");
|
||||
return {
|
||||
success: true,
|
||||
success: false,
|
||||
message:
|
||||
'El participante ya había registrado su asistencia previamente',
|
||||
data: {
|
||||
@@ -248,6 +250,8 @@ export class ParticipanteEventoService {
|
||||
const resultado =
|
||||
await this.participanteEventoRepository.save(participanteEvento);
|
||||
|
||||
//Borrar
|
||||
console.log("El usaurio se registro exitosamente");
|
||||
return {
|
||||
success: true,
|
||||
message: 'Asistencia registrada exitosamente',
|
||||
|
||||
@@ -67,23 +67,6 @@ export class QrTokenService {
|
||||
|
||||
const decoded = this.jwtService.verify(token, { secret });
|
||||
|
||||
let asistenciaEvento = await this.asistenciaRepository.findOne({
|
||||
where: {
|
||||
id_participante: decoded.id_participante,
|
||||
id_evento: decoded.id_evento,
|
||||
}
|
||||
})
|
||||
if(!asistenciaEvento){
|
||||
let newAsistencia=this.asistenciaRepository.create({estado:false,id_evento:decoded.id_evento, id_participante:decoded.id_participante})
|
||||
asistenciaEvento= await this.asistenciaRepository.save(newAsistencia)
|
||||
}
|
||||
|
||||
if (!asistenciaEvento?.estado) {
|
||||
asistenciaEvento.estado = true
|
||||
}else{
|
||||
throw new UnauthorizedException("El usuario ya se registró");
|
||||
}
|
||||
|
||||
// Verificar que sea un token de tipo QR de asistencia
|
||||
if (decoded.type !== 'qr_asistencia') {
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user