semicambios campos acatlan contigo
This commit is contained in:
@@ -28,7 +28,6 @@ const admin = async (body) => {
|
||||
fechaInicio: res.fechaInicio,
|
||||
fechaFin: res.fechaFin,
|
||||
fechaNacimiento: res.fechaNacimiento,
|
||||
carpeta: res.carpeta,
|
||||
cartaAceptacion: res.cartaAceptacion,
|
||||
cartaTermino: res.cartaTermino,
|
||||
informeGlobal: res.informeGlobal,
|
||||
@@ -64,7 +63,6 @@ const admin = async (body) => {
|
||||
clavePrograma: res.Programa.clavePrograma,
|
||||
acatlan: res.Programa.acatlan,
|
||||
activo: res.Programa.activo,
|
||||
idUsuario: res.Programa.idUsuario,
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
@@ -34,7 +34,6 @@ const alumno = async (body) => {
|
||||
fechaInicio: res.fechaInicio,
|
||||
fechaFin: res.fechaFin,
|
||||
fechaNacimiento: res.fechaNacimiento,
|
||||
carpeta: res.carpeta,
|
||||
cartaAceptacion: res.cartaAceptacion,
|
||||
cartaTermino: res.cartaTermino,
|
||||
informeGlobal: res.informeGlobal,
|
||||
@@ -61,7 +60,6 @@ const alumno = async (body) => {
|
||||
clavePrograma: res.Programa.clavePrograma,
|
||||
acatlan: res.Programa.acatlan,
|
||||
activo: res.Programa.activo,
|
||||
idUsuario: res.Programa.idUsuario,
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
@@ -3,6 +3,7 @@ const gmail = require('../../helper/gmail');
|
||||
const correos = require('../../helper/correos');
|
||||
const Servicio = require('../../db/tablas/Servicio');
|
||||
const Usuario = require('../../db/tablas/Usuario');
|
||||
// const Programa = require('../../db/tablas/Programa');
|
||||
|
||||
const liberacion = async (body) => {
|
||||
let idServicio = validar.validarId(body.idServicio);
|
||||
@@ -10,10 +11,16 @@ const liberacion = async (body) => {
|
||||
return Servicio.findOne({
|
||||
where: { idServicio },
|
||||
include: [{ model: Usuario }],
|
||||
// include: [{ model: Usuario }, { model: Programa }],
|
||||
})
|
||||
.then(async (res) => {
|
||||
if (!res) throw new Error('No existe este Servicio Social.');
|
||||
|
||||
/*
|
||||
if (res.Programa.acatlan && !body.vistoBuenoAcatlan)
|
||||
throw new Error(
|
||||
'El programa de este Servicio Solcial es Acatlán Contigo y no se envio la variable validando este servicio.'
|
||||
);
|
||||
*/
|
||||
switch (res.idStatus) {
|
||||
case 5:
|
||||
let correo = correos.terminoValidado(res.Usuario.nombre);
|
||||
@@ -42,6 +49,12 @@ const liberacion = async (body) => {
|
||||
})
|
||||
.then((res) => {
|
||||
return Servicio.update({ idStatus: 6 }, { where: { idServicio } });
|
||||
/*
|
||||
let data = { idStatus: 6 };
|
||||
|
||||
if (body.vistoBuenoAcatlan) data.vistoBuenoAcatlan = true;
|
||||
return Servicio.update(data, { where: { idServicio } });
|
||||
*/
|
||||
})
|
||||
.then((res) => {
|
||||
return {
|
||||
|
||||
@@ -18,6 +18,7 @@ const nuevo = async (body, file) => {
|
||||
let path = `./server/uploads/${validar.validar(file, 'El archivo')}`;
|
||||
let carpeta = '';
|
||||
let cartaAceptacion = '';
|
||||
// let programaInterno = validar.validarTexto
|
||||
|
||||
return Usuario.findOne({
|
||||
where: { idUsuario },
|
||||
|
||||
@@ -39,16 +39,33 @@ const validarCorreo = (correo) => {
|
||||
return correo;
|
||||
};
|
||||
|
||||
const caracteresEspeciales = (char) => {
|
||||
const charset = [' ', '.', '-', ',', '/', '#'];
|
||||
|
||||
for (let i = 0; i < charset.length; i++) if (charset[i] === char) return true;
|
||||
return false;
|
||||
};
|
||||
|
||||
const validarTexto = (texto, campo) => {
|
||||
noHay(texto, campo);
|
||||
if (typeof texto !== 'string') noValido(campo);
|
||||
for (let i = 0; i < texto.length; i++) {
|
||||
if (texto[i] === ' ') continue;
|
||||
if (caracteresEspeciales(texto[i])) continue;
|
||||
if (!validator.isAlpha(texto[i], 'es-ES')) noValido(campo);
|
||||
}
|
||||
return texto;
|
||||
};
|
||||
|
||||
const validarAlfanumerico = (texto, campo) => {
|
||||
noHay(texto, campo);
|
||||
if (typeof texto !== 'string') noValido(campo);
|
||||
for (let i = 0; i < texto.length; i++) {
|
||||
if (caracteresEspeciales(texto[i])) continue;
|
||||
if (!validator.isAlphanumeric(texto[i], 'es-ES')) noValido(campo);
|
||||
}
|
||||
return texto;
|
||||
};
|
||||
|
||||
const validarNumeroCuenta = (numeroCuenta) => {
|
||||
let campo = 'El numero de cuenta';
|
||||
|
||||
@@ -111,6 +128,7 @@ module.exports = {
|
||||
validarCorreo,
|
||||
validarId,
|
||||
validarTexto,
|
||||
validarAlfanumerico,
|
||||
validarNumeroCuenta,
|
||||
validarFecha,
|
||||
validarNumero,
|
||||
|
||||
Reference in New Issue
Block a user