This commit is contained in:
Andres2908
2022-08-04 17:12:39 -05:00
parent 8a4a53ee20
commit 36377b21b3
6 changed files with 35 additions and 9 deletions
@@ -5,7 +5,12 @@ const {
validarNumero,
validarNumeroCuenta,
} = require('../../helper/validar');
const {
agregarRecibo,
agregarDetalleServicio,
} = require('../../config/mariadb.conf');
const { eliminarArchivo } = require('../../helper/helper');
const { NUMBER } = require('sequelize');
const dbPath = '../../db/tablas';
const Inscripcion = require(`${dbPath}/Inscripcion`);
@@ -28,7 +33,12 @@ const inscripcion = async (body, file) => {
.then((res) => {
if (res) throw new Error('Este folio ya esta registrado');
return Inscripcion.findOne({
where: { idUsuario, idArea, cancelacion: 0 },
where: {
idUsuario,
idArea,
cancelacion: 0,
idPeriodo: Number(process.env.PERIODO),
},
}).then((res) => {
if (res) throw new Error('Ya estas registrado en esta área');
@@ -43,6 +53,7 @@ const inscripcion = async (body, file) => {
extension: file.mimetype.split('/')[1],
fechaInscripcion: ahora.format(),
fechaTicket,
idPeriodo: Number(process.env.PERIODO),
});
} else {
return Inscripcion.create({
@@ -66,7 +77,7 @@ const inscripcion = async (body, file) => {
agregarDetalleServicio(monto, numeroCuenta);
})
.then((res) => ({
message: `Tu inscripción está sujeta a validación por parte de un operador de CEDETEC, en caso de no ser correcta o veraz el servicio será suspendido. Por favor ingresa a <a href="https://kalinga.acatlan.unam.mx/cedetec/" target="_blank">Kalinga</a> para confirmar tu inscripción`,
message: `Tu inscripción está sujeta a validación por parte de un operador de CEDETEC, espera mas información en tu correo de Pc-puma.`,
}))
.catch((err) => {
if (file) eliminarArchivo(file.path);
+6 -1
View File
@@ -1,3 +1,4 @@
const { NUMBER } = require('sequelize');
const { validarNumeroEntero } = require('../../helper/validar');
const dbPath = '../../db/tablas';
const Inscripcion = require(`${dbPath}/Inscripcion`);
@@ -10,7 +11,11 @@ const inscripciones = async (body) => {
}).then((res) => {
if (!res) return [];
return Inscripcion.findAll({
where: { idUsuario, cancelacion: 0 },
where: {
idUsuario,
cancelacion: 0,
idPeriodo: Number(process.env.PERIODO),
},
attributes: [
'idInscripcion',
'validacion',