recibir profesor y programa interno, y perdir visto bueno de acatlan en caso de ser programa de acatlan

This commit is contained in:
Lemuel Marquez
2020-11-27 11:35:02 -06:00
parent d90c038f01
commit 7419b81868
6 changed files with 20 additions and 3215 deletions
+6 -3200
View File
File diff suppressed because it is too large Load Diff
+7 -11
View File
@@ -3,24 +3,23 @@ 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 Programa = require('../../db/tablas/Programa');
const liberacion = async (body) => {
let idServicio = validar.validarId(body.idServicio);
return Servicio.findOne({
where: { idServicio },
include: [{ model: Usuario }],
// include: [{ model: Usuario }, { model: Programa }],
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);
@@ -48,13 +47,10 @@ const liberacion = async (body) => {
}
})
.then((res) => {
return Servicio.update({ idStatus: 6 }, { where: { idServicio } });
/*
let data = { idStatus: 6 };
let update = { idStatus: 6 };
if (body.vistoBuenoAcatlan) data.vistoBuenoAcatlan = true;
return Servicio.update(data, { where: { idServicio } });
*/
if (body.vistoBuenoAcatlan) update.vistoBuenoAcatlan = true;
return Servicio.update(update, { where: { idServicio } });
})
.then((res) => {
return {
+7 -4
View File
@@ -17,8 +17,10 @@ const nuevo = async (body, file) => {
let fechaFin = validar.validarFecha(body.fechaFin);
let path = `./server/uploads/${validar.validar(file, 'El archivo')}`;
let carpeta = '';
let cartaAceptacion = '';
// let programaInterno = validar.validarTexto
let programaInterno = body.programaInterno
? validar.validarTexto(body.programaInterno)
: '';
let profesor = body.profesor ? validar.validarTexto(body.profesor) : '';
return Usuario.findOne({
where: { idUsuario },
@@ -54,7 +56,6 @@ const nuevo = async (body, file) => {
);
})
.then((res) => {
cartaAceptacion = res;
return Servicio.create({
idUsuario,
idPrograma,
@@ -64,7 +65,9 @@ const nuevo = async (body, file) => {
fechaInicio,
fechaFin,
carpeta,
cartaAceptacion,
cartaAceptacion: res,
profesor,
programaInterno,
});
})
.then((res) => {