Inscripcion sin ticket

This commit is contained in:
Andres2908
2022-02-03 00:11:03 -06:00
parent 0ff4360ca7
commit 83cbd46bc3
4 changed files with 26 additions and 19 deletions
+25 -19
View File
@@ -24,28 +24,34 @@ const inscripcion = async (body, file) => {
where: { idUsuario, idArea },
}).then((res) => {
if (res) throw new Error('Ya estas registrado en esta área');
return Inscripcion.create({
idUsuario,
confirmacion: true,
folio: body.folio,
monto: body.monto,
idArea,
fechaInscripcion: ahora.format(),
fechaTicket: body.fechaTicket,
rutaTicket: file.path,
});
if (file) {
return Inscripcion.create({
idUsuario,
folio,
monto: body.monto,
idArea,
fechaInscripcion: ahora.format(),
fechaTicket: body.fechaTicket,
rutaTicket: file.path,
});
} else {
return Inscripcion.create({
idUsuario,
idArea,
fechaInscripcion: ahora.format(),
});
}
});
})
.then(
(res) => (
fs.renameSync(file.path, file.path + '.' + file.mimetype.split('/')[1]),
{
message: '¡La inscripción se realizo de manera correcta!',
}
)
)
.then((res) => {
if (file)
fs.renameSync(file.path, file.path + '.' + file.mimetype.split('/')[1]);
})
.then((res) => ({
message: '¡La inscripción se realizo de manera correcta!',
}))
.catch((err) => {
eliminarArchivo(file.path);
if (file) eliminarArchivo(file.path);
throw new Error('No es posible realizar esta inscripción. ' + err);
});
};
+1
View File
@@ -22,6 +22,7 @@ Inscripcion.init(
confirmacion: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: false,
},
folio: {
type: DataTypes.STRING(5),
Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 998 KiB