Solucion de errores

This commit is contained in:
Andres2908
2022-01-31 22:51:21 -06:00
parent 4ab56e9a5e
commit 3b5122e8ea
4 changed files with 21 additions and 14 deletions
+1 -1
View File
@@ -12,7 +12,7 @@ const sequelize = new Sequelize(
dialectOptions: {
useUTC: false,
},
timezone: '-05:00',
timezone: '-06:00',
}
);
+18 -11
View File
@@ -11,20 +11,27 @@ const ahora = moment();
const inscripcion = async (body) => {
const idUsuario = validarNumeroEntero(body.idUsuario, 'id Usuario', true);
const idArea = validarNumeroEntero(body.idArea, 'id Area', true);
const folio = body.folio;
return Inscripcion.findOne({
where: { idArea: body.idArea },
where: { folio },
})
.then((res) => {
if (res) throw new Error('Usted ya esta inscrito a esta Area');
return Inscripcion.create({
idUsuario,
confirmacion: true,
folio: body.folio,
monto: body.monto,
idArea,
fechaIncripcion: ahora.format(),
fechaTicket: body.fechaTicket,
idFechaInscripcion: body.idFechaInscripcion,
if (res) throw new Error('Este folio ya esta registrado');
return Inscripcion.findOne({
where: { 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,
fechaIncripcion: ahora.format(),
fechaTicket: body.fechaTicket,
idFechaInscripcion: body.idFechaInscripcion,
});
});
})
.then((res) => ({
+1 -1
View File
@@ -25,7 +25,7 @@ const login = async (body) => {
return datos;
})
.catch((err) => {
throw new Error('Usuario o contraseña incorrecta.' + err);
throw new Error('Usuario o contraseña incorrecta.');
});
};
+1 -1
View File
@@ -24,7 +24,7 @@ Inscripcion.init(
allowNull: false,
},
folio: {
type: DataTypes.STRING(10),
type: DataTypes.STRING(5),
allowNull: true,
defaultValue: null,
unique: true,