Solucion de errores
This commit is contained in:
@@ -12,7 +12,7 @@ const sequelize = new Sequelize(
|
||||
dialectOptions: {
|
||||
useUTC: false,
|
||||
},
|
||||
timezone: '-05:00',
|
||||
timezone: '-06:00',
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -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) => ({
|
||||
|
||||
@@ -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.');
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ Inscripcion.init(
|
||||
allowNull: false,
|
||||
},
|
||||
folio: {
|
||||
type: DataTypes.STRING(10),
|
||||
type: DataTypes.STRING(5),
|
||||
allowNull: true,
|
||||
defaultValue: null,
|
||||
unique: true,
|
||||
|
||||
Reference in New Issue
Block a user