organización de endpoints
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
const validar = require('../../helper/validar');
|
||||
const { validarId } = require('../../helper/validar');
|
||||
const dbPath = '../../db/tablas';
|
||||
const Carrera = require(`${dbPath}/Carrera`);
|
||||
const Programa = require(`${dbPath}/Programa`);
|
||||
@@ -8,7 +8,7 @@ const TipoUsuario = require(`${dbPath}/TipoUsuario`);
|
||||
const Usuario = require(`${dbPath}/Usuario`);
|
||||
|
||||
const admin = async (body) => {
|
||||
const idServicio = validar.validarId(body.idServicio);
|
||||
const idServicio = validarId(body.idServicio);
|
||||
|
||||
return Servicio.findOne({
|
||||
where: { idServicio },
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const { Op } = require('sequelize');
|
||||
const validar = require('../../helper/validar');
|
||||
const { validarId } = require('../../helper/validar');
|
||||
const dbPath = '../../db/tablas';
|
||||
const Carrera = require(`${dbPath}/Carrera`);
|
||||
const Programa = require(`${dbPath}/Programa`);
|
||||
@@ -8,7 +8,7 @@ const Status = require(`${dbPath}/Status`);
|
||||
const Usuario = require(`${dbPath}/Usuario`);
|
||||
|
||||
const alumno = async (body) => {
|
||||
let idUsuario = validar.validarId(body.idUsuario);
|
||||
let idUsuario = validarId(body.idUsuario);
|
||||
|
||||
return Usuario.findOne({ where: { idUsuario } })
|
||||
.then((res) => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const helperPath = '../../helper';
|
||||
const validar = require(`${helperPath}/validar`);
|
||||
const gmail = require(`${helperPath}/gmail`);
|
||||
const correos = require(`${helperPath}/correos`);
|
||||
const gmail = require(`${helperPath}/gmail`);
|
||||
const validar = require(`${helperPath}/validar`);
|
||||
const dbPath = '../../db/tablas';
|
||||
const Programa = require(`${dbPath}/Programa`);
|
||||
const Servicio = require(`${dbPath}/Servicio`);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const helperPath = '../../helper';
|
||||
const validar = require(`${helperPath}/validar`);
|
||||
const drive = require(`${helperPath}/drive`);
|
||||
const validar = require(`${helperPath}/validar`);
|
||||
const Servicio = require('../../db/tablas/Servicio');
|
||||
|
||||
const cartaTermino = async (body, file) => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const helperPath = '../../helper';
|
||||
const validar = require(`${helperPath}/validar`);
|
||||
const drive = require(`${helperPath}/drive`);
|
||||
const validar = require(`${helperPath}/validar`);
|
||||
const Servicio = require('../../db/tablas/Servicio');
|
||||
|
||||
const cartaTermino = async (body, file) => {
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
const fs = require('fs');
|
||||
const moment = require('moment');
|
||||
const { convertArrayToCSV } = require('convert-array-to-csv');
|
||||
const { Op } = require('sequelize');
|
||||
const validar = require('../../helper/validar');
|
||||
const helperPath = '../../helper';
|
||||
const helper = require(`${helperPath}/helper`);
|
||||
const validar = require(`${helperPath}/validar`);
|
||||
const dbPath = '../../db/tablas';
|
||||
const Carrera = require(`${dbPath}/Carrera`);
|
||||
const Servicio = require(`${dbPath}/Servicio`);
|
||||
@@ -32,12 +33,12 @@ const gustavoBazPrada = async (body) => {
|
||||
nombre: res[i].Usuario.nombre,
|
||||
licenciatura: res[i].Carrera.carrera,
|
||||
correo: res[i].correo,
|
||||
fechaLiberacion: validar.crearDDMMAAAA(res[i].fechaLiberacion),
|
||||
fechaLiberacion: helper.crearDDMMAAAA(res[i].fechaLiberacion),
|
||||
});
|
||||
await validar.eliminarArchivo(path).catch((err) => {
|
||||
await helper.eliminarArchivo(path).catch((err) => {
|
||||
console.log(err);
|
||||
});
|
||||
return validar.crearArchivo(path, convertArrayToCSV(data));
|
||||
return helper.crearArchivo(path, convertArrayToCSV(data));
|
||||
})
|
||||
.then((res) => {
|
||||
return path;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const helperPath = '../../helper';
|
||||
const validar = require(`${helperPath}/validar`);
|
||||
const drive = require(`${helperPath}/drive`);
|
||||
const validar = require(`${helperPath}/validar`);
|
||||
const Servicio = require('../../db/tablas/Servicio');
|
||||
|
||||
const informeGlobal = async (body, file) => {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
const moment = require('moment');
|
||||
const helperPath = '../../helper';
|
||||
const validar = require(`${helperPath}/validar`);
|
||||
const gmail = require(`${helperPath}/gmail`);
|
||||
const correos = require(`${helperPath}/correos`);
|
||||
const gmail = require(`${helperPath}/gmail`);
|
||||
const validar = require(`${helperPath}/validar`);
|
||||
const dbPath = '../../db/tablas';
|
||||
const Programa = require(`${dbPath}/Programa`);
|
||||
const Servicio = require(`${dbPath}/Servicio`);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const { Op } = require('sequelize');
|
||||
const helperPath = '../../helper';
|
||||
const validar = require(`${helperPath}/validar`);
|
||||
const drive = require(`${helperPath}/drive`);
|
||||
const validar = require(`${helperPath}/validar`);
|
||||
const dbPath = '../../db/tablas';
|
||||
const Carrera = require(`${dbPath}/Carrera`);
|
||||
const Programa = require(`${dbPath}/Programa`);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const helperPath = '../../helper';
|
||||
const validar = require(`${helperPath}/validar`);
|
||||
const gmail = require(`${helperPath}/gmail`);
|
||||
const correos = require(`${helperPath}/correos`);
|
||||
const gmail = require(`${helperPath}/gmail`);
|
||||
const validar = require(`${helperPath}/validar`);
|
||||
const dbPath = '../../db/tablas';
|
||||
const Programa = require(`${dbPath}/Programa`);
|
||||
const Servicio = require(`${dbPath}/Servicio`);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const helperPath = '../../helper';
|
||||
const validar = require(`${helperPath}/validar`);
|
||||
const gmail = require(`${helperPath}/gmail`);
|
||||
const correos = require(`${helperPath}/correos`);
|
||||
const gmail = require(`${helperPath}/gmail`);
|
||||
const validar = require(`${helperPath}/validar`);
|
||||
const dbPath = '../../db/tablas';
|
||||
const Programa = require(`${dbPath}/Programa`);
|
||||
const Servicio = require(`${dbPath}/Servicio`);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const helperPath = '../../helper';
|
||||
const validar = require(`${helperPath}/validar`);
|
||||
const gmail = require(`${helperPath}/gmail`);
|
||||
const correos = require(`${helperPath}/correos`);
|
||||
const gmail = require(`${helperPath}/gmail`);
|
||||
const validar = require(`${helperPath}/validar`);
|
||||
const dbPath = '../../db/tablas';
|
||||
const Programa = require(`${dbPath}/Programa`);
|
||||
const Servicio = require(`${dbPath}/Servicio`);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
const helperPath = '../../helper';
|
||||
const validar = require(`${helperPath}/validar`);
|
||||
const correos = require(`${helperPath}/correos`);
|
||||
const encriptar = require(`${helperPath}/encriptar`);
|
||||
const gmail = require(`${helperPath}/gmail`);
|
||||
const correos = require(`${helperPath}/correos`);
|
||||
const validar = require(`${helperPath}/validar`);
|
||||
const dbPath = '../../db/tablas';
|
||||
const Servicio = require(`${dbPath}/Servicio`);
|
||||
const Usuario = require(`${dbPath}/Usuario`);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const helperPath = '../../helper';
|
||||
const validar = require(`${helperPath}/validar`);
|
||||
const gmail = require(`${helperPath}/gmail`);
|
||||
const correos = require(`${helperPath}/correos`);
|
||||
const gmail = require(`${helperPath}/gmail`);
|
||||
const validar = require(`${helperPath}/validar`);
|
||||
const dbPath = '../../db/tablas';
|
||||
const Programa = require(`${dbPath}/Programa`);
|
||||
const Servicio = require(`${dbPath}/Servicio`);
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
const fs = require('fs');
|
||||
const { convertArrayToCSV } = require('convert-array-to-csv');
|
||||
const { Op } = require('sequelize');
|
||||
const validar = require('../../helper/validar');
|
||||
const helperPath = '../../helper';
|
||||
const helper = require(`${helperPath}/helper`);
|
||||
const { validarFecha } = require(`${helperPath}/validar`);
|
||||
const dbPath = '../../db/tablas';
|
||||
const Carrera = require(`${dbPath}/Carrera`);
|
||||
const Programa = require(`${dbPath}/Programa`);
|
||||
@@ -10,8 +11,8 @@ const Status = require(`${dbPath}/Status`);
|
||||
const Usuario = require(`${dbPath}/Usuario`);
|
||||
|
||||
const reporte = async (body) => {
|
||||
const inicio = validar.validarFecha(body.inicio);
|
||||
const fin = validar.validarFecha(body.fin);
|
||||
const inicio = validarFecha(body.inicio);
|
||||
const fin = validarFecha(body.fin);
|
||||
const path = `server/uploads/reporte.csv`;
|
||||
const data = [];
|
||||
|
||||
@@ -37,9 +38,9 @@ const reporte = async (body) => {
|
||||
nombre: res[i].Usuario.nombre,
|
||||
licenciatura: res[i].Carrera.carrera,
|
||||
correo: res[i].correo,
|
||||
fechaInicio: validar.crearDDMMAAAA(res[i].fechaInicio),
|
||||
fechaFin: validar.crearDDMMAAAA(res[i].fechaFin),
|
||||
fechaLiberacion: validar.crearDDMMAAAA(res[i].fechaLiberacion),
|
||||
fechaInicio: helper.crearDDMMAAAA(res[i].fechaInicio),
|
||||
fechaFin: helper.crearDDMMAAAA(res[i].fechaFin),
|
||||
fechaLiberacion: helper.crearDDMMAAAA(res[i].fechaLiberacion),
|
||||
institucion: res[i].Programa.institucion,
|
||||
dependencia: res[i].Programa.dependencia,
|
||||
programa: res[i].Programa.programa,
|
||||
@@ -47,10 +48,10 @@ const reporte = async (body) => {
|
||||
clave: res[i].Programa.clavePrograma,
|
||||
status: res[i].Status.status,
|
||||
});
|
||||
await validar.eliminarArchivo(path).catch((err) => {
|
||||
await helper.eliminarArchivo(path).catch((err) => {
|
||||
console.log(err);
|
||||
});
|
||||
return validar.crearArchivo(path, convertArrayToCSV(data));
|
||||
return helper.crearArchivo(path, convertArrayToCSV(data));
|
||||
})
|
||||
.then((res) => {
|
||||
return path;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const helperPath = '../../helper';
|
||||
const validar = require(`${helperPath}/validar`);
|
||||
const drive = require(`${helperPath}/drive`);
|
||||
const validar = require(`${helperPath}/validar`);
|
||||
const Servicio = require('../../db/tablas/Servicio');
|
||||
|
||||
const update = async (body, files) => {
|
||||
@@ -52,7 +52,7 @@ const update = async (body, files) => {
|
||||
);
|
||||
if (body.telefono)
|
||||
dataUpdate.telefono = validar.validarNumero(body.telefono, 15);
|
||||
if (validar.isObjectEmpty(dataUpdate))
|
||||
if (validar.validarObjetoVacio(dataUpdate))
|
||||
throw new Error(
|
||||
'No se envio nada para actualizar este Servicio Social'
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user