Compare commits
40 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8624198286 | |||
| 0c51bd1b35 | |||
| 0f8237a205 | |||
| 19f436b325 | |||
| 1fc4734079 | |||
| 173140257a | |||
| 8192645db6 | |||
| 2ec1584064 | |||
| df96fc3f6a | |||
| 51851a500f | |||
| 7d18612953 | |||
| ec27f5b542 | |||
| 2809958203 | |||
| c04ca252df | |||
| b33deda664 | |||
| 9af53a7859 | |||
| 1137eb5d91 | |||
| f303e5c869 | |||
| 2dfbc7708b | |||
| 9799336008 | |||
| 96e5121119 | |||
| 02ec8c2b73 | |||
| 2a8c990358 | |||
| 387603650d | |||
| d63ca1e05c | |||
| 456967b036 | |||
| d5413a5fe8 | |||
| c4e233c696 | |||
| e1b0e21ed7 | |||
| 5f5a0e9e28 | |||
| 1d1461cf1b | |||
| 7177449531 | |||
| 5aa6544e30 | |||
| 9741afc8ae | |||
| 8599203a80 | |||
| 48d882bbd2 | |||
| d2751a07f1 | |||
| ee27a9db64 | |||
| 9c321c622f | |||
| 70cc64a813 |
+1
-1
@@ -12,7 +12,7 @@
|
|||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": ""
|
"url": "https://repositorio.acatlan.unam.mx/CIDWA/pcpuma_acatlan_api.git"
|
||||||
},
|
},
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ const obtenerAlumno = async (numeroCuenta) => {
|
|||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
conn.end();
|
conn.end();
|
||||||
throw new Error('Hubo un problema con el querry.' + err);
|
throw new Error('Hubo un problema, intenta más tarde.');
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ const equipos = async () =>
|
|||||||
where: { idCarrito: res[i].idCarrito },
|
where: { idCarrito: res[i].idCarrito },
|
||||||
include: [{ model: Status }],
|
include: [{ model: Status }],
|
||||||
attributes: ['idEquipo', 'numeroSerie', 'numeroInventario', 'equipo'],
|
attributes: ['idEquipo', 'numeroSerie', 'numeroInventario', 'equipo'],
|
||||||
|
order: [['equipo', 'ASC']],
|
||||||
});
|
});
|
||||||
return res;
|
return res;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ const validar = require('../../helper/validar');
|
|||||||
const dbPath = '../../db/tablas';
|
const dbPath = '../../db/tablas';
|
||||||
const Carrito = require(`${dbPath}/Carrito`);
|
const Carrito = require(`${dbPath}/Carrito`);
|
||||||
const Equipo = require(`${dbPath}/Equipo`);
|
const Equipo = require(`${dbPath}/Equipo`);
|
||||||
|
const Motivo = require(`${dbPath}/Motivo`);
|
||||||
const Programa = require(`${dbPath}/Programa`);
|
const Programa = require(`${dbPath}/Programa`);
|
||||||
const Status = require(`${dbPath}/Status`);
|
const Status = require(`${dbPath}/Status`);
|
||||||
|
|
||||||
@@ -20,14 +21,20 @@ const update = async (body) => {
|
|||||||
const idPrograma = body.idPrograma
|
const idPrograma = body.idPrograma
|
||||||
? validar.validarNumeroEntero(body.idPrograma, 'id programa', true)
|
? validar.validarNumeroEntero(body.idPrograma, 'id programa', true)
|
||||||
: '';
|
: '';
|
||||||
|
const motivo = body.motivo
|
||||||
|
? validar.validarAlfanumerico(body.motivo, 'motivo', true, 500)
|
||||||
|
: '';
|
||||||
let update = {};
|
let update = {};
|
||||||
|
|
||||||
return Status.findOne({ where: { idStatus } })
|
return Status.findOne({ where: { idStatus } })
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (idStatus) {
|
if (idStatus) {
|
||||||
if (!res) throw new Error('No existe este status.');
|
if (!res) throw new Error('No existe este status.');
|
||||||
|
if (!motivo)
|
||||||
|
throw new Error('No se mando el motivo de cambio de status.');
|
||||||
update.idStatus = idStatus;
|
update.idStatus = idStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Carrito.findOne({ where: { idCarrito } });
|
return Carrito.findOne({ where: { idCarrito } });
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
@@ -46,8 +53,9 @@ const update = async (body) => {
|
|||||||
throw new Error('No se envió nada para actualizar.');
|
throw new Error('No se envió nada para actualizar.');
|
||||||
return Equipo.findOne({ where: { idEquipo } });
|
return Equipo.findOne({ where: { idEquipo } });
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then(async (res) => {
|
||||||
if (!res) throw new Error('No existe este equipo.');
|
if (!res) throw new Error('No existe este equipo.');
|
||||||
|
if (idStatus) await Motivo.create({ motivo, idEquipo, idStatus });
|
||||||
return Equipo.update(update, { where: { idEquipo } });
|
return Equipo.update(update, { where: { idEquipo } });
|
||||||
})
|
})
|
||||||
.then(() => ({ message: 'Se actualizó correctamente el equipo.' }));
|
.then(() => ({ message: 'Se actualizó correctamente el equipo.' }));
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
const { validarNumeroEntero } = require('../../helper/validar');
|
||||||
|
const dbPath = '../../db/tablas';
|
||||||
|
const Motivo = require(`${dbPath}/Motivo`);
|
||||||
|
const Equipo = require(`${dbPath}/Equipo`);
|
||||||
|
const Status = require(`${dbPath}/Status`);
|
||||||
|
|
||||||
|
const historialMotivosEquipo = async (body) => {
|
||||||
|
const pagina = validarNumeroEntero(body.pagina, 'página', false);
|
||||||
|
const idEquipo = validarNumeroEntero(body.idEquipo, 'id equipo', true);
|
||||||
|
|
||||||
|
return Motivo.findAndCountAll({
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
model: Equipo,
|
||||||
|
where: { idEquipo },
|
||||||
|
attributes: [],
|
||||||
|
},
|
||||||
|
{ model: Status },
|
||||||
|
],
|
||||||
|
attributes: ['idMotivo', 'motivo'],
|
||||||
|
limit: 25,
|
||||||
|
offset: 25 * (pagina - 1),
|
||||||
|
order: [['idMotivo', 'DESC']],
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = historialMotivosEquipo;
|
||||||
@@ -18,24 +18,6 @@ const historialMultasUsuario = async (body) => {
|
|||||||
{
|
{
|
||||||
model: Prestamo,
|
model: Prestamo,
|
||||||
where: { idUsuario },
|
where: { idUsuario },
|
||||||
// include: [
|
|
||||||
// {
|
|
||||||
// model: Equipo,
|
|
||||||
// include: [
|
|
||||||
// {
|
|
||||||
// model: Carrito,
|
|
||||||
// include: [{ model: Modulo }, { model: TipoCarrito }],
|
|
||||||
// attributes: ['idCarrito', 'carrito'],
|
|
||||||
// },
|
|
||||||
// ],
|
|
||||||
// attributes: [
|
|
||||||
// 'idEquipo',
|
|
||||||
// 'numeroSerie',
|
|
||||||
// 'numeroInventario',
|
|
||||||
// 'equipo',
|
|
||||||
// ],
|
|
||||||
// },
|
|
||||||
// ],
|
|
||||||
attributes: ['idPrestamo'],
|
attributes: ['idPrestamo'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ const multar = async (body) => {
|
|||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (!res) throw new Error('No existe esta infracción.');
|
if (!res) throw new Error('No existe esta infracción.');
|
||||||
// Checar si tiene una multa activa, agragar días a multa
|
|
||||||
gravedad = res.gravedad;
|
gravedad = res.gravedad;
|
||||||
return Prestamo.findOne({
|
return Prestamo.findOne({
|
||||||
where: { idPrestamo },
|
where: { idPrestamo },
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
const validar = require('../../helper/validar');
|
||||||
|
const dbPath = '../../db/tablas';
|
||||||
|
const Multa = require(`${dbPath}/Multa`);
|
||||||
|
const Usuario = require(`${dbPath}/Usuario`);
|
||||||
|
|
||||||
|
const multar = async (body) => {
|
||||||
|
const idUsuario = validar.validarNumeroEntero(
|
||||||
|
body.idUsuario,
|
||||||
|
'id usuario',
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
return Usuario.findOne({ where: { idUsuario } })
|
||||||
|
.then((res) => {
|
||||||
|
if (!res) throw new Error('No existe este usuario.');
|
||||||
|
return Multa.findAll({ where: { idUsuario, activo: true } });
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
if (res.length > 2)
|
||||||
|
throw new Error(
|
||||||
|
'El usuario tiene más de 2 multas activas, favor de notificar a un operador sobre este problema.'
|
||||||
|
);
|
||||||
|
return res;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = multar;
|
||||||
@@ -1,13 +1,23 @@
|
|||||||
const io = require('../../socket');
|
const io = require('../../socket');
|
||||||
const { validarNumeroEntero } = require('../../helper/validar');
|
const validar = require('../../helper/validar');
|
||||||
const dbPath = '../../db/tablas';
|
const dbPath = '../../db/tablas';
|
||||||
const Equipo = require(`${dbPath}/Equipo`);
|
const Equipo = require(`${dbPath}/Equipo`);
|
||||||
|
const Motivo = require(`${dbPath}/Motivo`);
|
||||||
const Operador = require(`${dbPath}/Operador`);
|
const Operador = require(`${dbPath}/Operador`);
|
||||||
const Prestamo = require(`${dbPath}/Prestamo`);
|
const Prestamo = require(`${dbPath}/Prestamo`);
|
||||||
|
|
||||||
const cancelarOperador = async (body) => {
|
const cancelarOperador = async (body) => {
|
||||||
const idPrestamo = validarNumeroEntero(body.idPrestamo, 'id préstamo', true);
|
const idPrestamo = validar.validarNumeroEntero(
|
||||||
const idOperador = validarNumeroEntero(body.idOperador, 'id operador', true);
|
body.idPrestamo,
|
||||||
|
'id préstamo',
|
||||||
|
true
|
||||||
|
);
|
||||||
|
const idOperador = validar.validarNumeroEntero(
|
||||||
|
body.idOperador,
|
||||||
|
'id operador',
|
||||||
|
true
|
||||||
|
);
|
||||||
|
const motivo = validar.validarAlfanumerico(body.motivo, 'motivo', true, 500);
|
||||||
let idUsuario = null;
|
let idUsuario = null;
|
||||||
|
|
||||||
return Operador.findOne({ where: { idOperador } })
|
return Operador.findOne({ where: { idOperador } })
|
||||||
@@ -15,15 +25,16 @@ const cancelarOperador = async (body) => {
|
|||||||
if (!res) throw new Error('No existe este operador.');
|
if (!res) throw new Error('No existe este operador.');
|
||||||
return Prestamo.findOne({ where: { idPrestamo } });
|
return Prestamo.findOne({ where: { idPrestamo } });
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then(async (res) => {
|
||||||
if (!res) throw new Error('Este préstamo no existe.');
|
if (!res) throw new Error('Este préstamo no existe.');
|
||||||
idUsuario = res.idUsuario;
|
idUsuario = res.idUsuario;
|
||||||
if (!res.activo)
|
if (!res.activo)
|
||||||
throw new Error(
|
throw new Error(
|
||||||
'Este préstamo ya no esta activo, no se puede cancelar.'
|
'Este préstamo ya no esta activo, no se puede cancelar.'
|
||||||
);
|
);
|
||||||
|
await Motivo.create({ motivo, idEquipo: res.idEquipo, idStatus: 9 });
|
||||||
return Equipo.update(
|
return Equipo.update(
|
||||||
{ idStatus: 4 },
|
{ idStatus: 9 },
|
||||||
{ where: { idEquipo: res.idEquipo } }
|
{ where: { idEquipo: res.idEquipo } }
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -50,11 +50,13 @@ const entregar = async (body) => {
|
|||||||
'Ya pasó el tiempo límite para recoger el equipo de cómputo.'
|
'Ya pasó el tiempo límite para recoger el equipo de cómputo.'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
// if (ahora > moment(`${ahora.format('YYYY-MM-DD')} 17:45`))
|
if (ahora > moment(`${ahora.format('YYYY-MM-DD')} 17:45`))
|
||||||
// update.horaFin = moment(`${ahora.format('YYYY-MM-DD')} 19:45`);
|
update.horaFin = moment(`${ahora.format('YYYY-MM-DD')} 19:45`);
|
||||||
// else update.horaFin = ahora.add(2, 'h').format();
|
else update.horaFin = ahora.add(2, 'h').format();
|
||||||
update.horaFin = ahora.add(2, 'h').format();
|
return Equipo.update(
|
||||||
return Equipo.update({ idStatus: 2 }, { where: { idEquipo } });
|
{ idStatus: 2, prestado: true },
|
||||||
|
{ where: { idEquipo } }
|
||||||
|
);
|
||||||
})
|
})
|
||||||
.then(() => Prestamo.update(update, { where: { idPrestamo } }))
|
.then(() => Prestamo.update(update, { where: { idPrestamo } }))
|
||||||
.then(() =>
|
.then(() =>
|
||||||
|
|||||||
@@ -92,9 +92,9 @@ const historial = async (body) => {
|
|||||||
'regresoInmediato',
|
'regresoInmediato',
|
||||||
'createdAt',
|
'createdAt',
|
||||||
],
|
],
|
||||||
|
order: [['idPrestamo', 'DESC']],
|
||||||
limit: 25,
|
limit: 25,
|
||||||
offset: 25 * (pagina - 1),
|
offset: 25 * (pagina - 1),
|
||||||
order: [['createdAt', 'DESC']],
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -30,14 +30,14 @@ const pedir = async (body) => {
|
|||||||
let whereEquipo = { idStatus: 4 };
|
let whereEquipo = { idStatus: 4 };
|
||||||
let idEquipo;
|
let idEquipo;
|
||||||
|
|
||||||
// if (ahora.day() === 6 || ahora.day() === 0)
|
if (ahora.day() === 6 || ahora.day() === 0)
|
||||||
// throw new Error(
|
throw new Error(
|
||||||
// 'No se puede pedir un equipo de cómputo los días sabados y domingos.'
|
'No se puede pedir un equipo de cómputo los días sabados y domingos.'
|
||||||
// );
|
);
|
||||||
// if (ahora > horaMax)
|
if (ahora > horaMax)
|
||||||
// throw new Error('Ya no se puede realizar un préstamo el día de hoy.');
|
throw new Error('Ya no se puede realizar un préstamo el día de hoy.');
|
||||||
// if (ahora < horaMin)
|
if (ahora < horaMin)
|
||||||
// throw new Error('Aún es muy temprano para realizar un préstamo.');
|
throw new Error('Aún es muy temprano para realizar un préstamo.');
|
||||||
return TipoCarrito.findOne({ where: { idTipoCarrito } })
|
return TipoCarrito.findOne({ where: { idTipoCarrito } })
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (!res) throw new Error('No existe este tipo de equipo.');
|
if (!res) throw new Error('No existe este tipo de equipo.');
|
||||||
@@ -84,7 +84,7 @@ const pedir = async (body) => {
|
|||||||
'Tienes un préstamo activo. No puedes solicitar otro equipo de cómputo.'
|
'Tienes un préstamo activo. No puedes solicitar otro equipo de cómputo.'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return Equipo.findOne({
|
return Equipo.count({
|
||||||
where: whereEquipo,
|
where: whereEquipo,
|
||||||
include: [
|
include: [
|
||||||
{
|
{
|
||||||
@@ -92,7 +92,49 @@ const pedir = async (body) => {
|
|||||||
where: { idTipoCarrito, idModulo, activo: true },
|
where: { idTipoCarrito, idModulo, activo: true },
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
order: [['updatedAt']],
|
});
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
if (res === 0)
|
||||||
|
throw new Error(
|
||||||
|
'No existe un equipo de cómputo con las características solicitadas. Intenta elegir otro tipo de equipo.'
|
||||||
|
);
|
||||||
|
return Equipo.count({
|
||||||
|
where: { ...whereEquipo, prestado: false },
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
model: Carrito,
|
||||||
|
where: { idTipoCarrito, idModulo, activo: true },
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.then(async (res) => {
|
||||||
|
if (res === 0)
|
||||||
|
await Equipo.update(
|
||||||
|
{ prestado: false },
|
||||||
|
{
|
||||||
|
where: { ...whereEquipo, prestado: true },
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
model: Carrito,
|
||||||
|
where: { idTipoCarrito, idModulo, activo: true },
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
);
|
||||||
|
return Equipo.findOne({
|
||||||
|
where: { ...whereEquipo, prestado: false },
|
||||||
|
include: [
|
||||||
|
{
|
||||||
|
model: Carrito,
|
||||||
|
where: { idTipoCarrito, idModulo, activo: true },
|
||||||
|
},
|
||||||
|
],
|
||||||
|
order: [
|
||||||
|
['idCarrito', 'ASC'],
|
||||||
|
['equipo', 'ASC'],
|
||||||
|
],
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
@@ -110,7 +152,7 @@ const pedir = async (body) => {
|
|||||||
idEquipo,
|
idEquipo,
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
.then((res) => {
|
.then(() => {
|
||||||
io.getIO().emit('actualizar', { idUsuario });
|
io.getIO().emit('actualizar', { idUsuario });
|
||||||
return {
|
return {
|
||||||
message:
|
message:
|
||||||
|
|||||||
@@ -34,8 +34,8 @@ const reporte = async (body) => {
|
|||||||
return Prestamo.findAll({
|
return Prestamo.findAll({
|
||||||
where: {
|
where: {
|
||||||
[Op.and]: [
|
[Op.and]: [
|
||||||
{ createdAt: { [Op.gte]: inicio.add(-1, 'd').format() } },
|
{ createdAt: { [Op.gte]: inicio.format('YYYY-MM-DD') } },
|
||||||
{ createdAt: { [Op.lte]: fin.add(1, 'd').format() } },
|
{ createdAt: { [Op.lte]: fin.format('YYYY-MM-DD') } },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
include: [
|
include: [
|
||||||
@@ -95,10 +95,18 @@ const reporte = async (body) => {
|
|||||||
fecha: moment(res[i].createdAt).format('YYYY-MM-DD'),
|
fecha: moment(res[i].createdAt).format('YYYY-MM-DD'),
|
||||||
hora: moment(res[i].createdAt).format('HH:mm'),
|
hora: moment(res[i].createdAt).format('HH:mm'),
|
||||||
horaMaxRecoger: moment(res[i].horaMaxRecoger).format('HH:mm'),
|
horaMaxRecoger: moment(res[i].horaMaxRecoger).format('HH:mm'),
|
||||||
horaInicio: moment(res[i].horaInicio).format('HH:mm'),
|
horaInicio: res[i].horaInicio
|
||||||
horaFin: moment(res[i].horaFin).format('HH:mm'),
|
? moment(res[i].horaInicio).format('HH:mm')
|
||||||
fechaEntrega: moment(res[i].horaEntrega).format('YYYY-MM-DD'),
|
: '',
|
||||||
horaEntrega: moment(res[i].horaEntrega).format('HH:mm'),
|
horaFin: res[i].horaFin
|
||||||
|
? moment(res[i].horaFin).format('HH:mm')
|
||||||
|
: '',
|
||||||
|
fechaEntrega: res[i].horaEntrega
|
||||||
|
? moment(res[i].horaEntrega).format('YYYY-MM-DD')
|
||||||
|
: '',
|
||||||
|
horaEntrega: res[i].horaEntrega
|
||||||
|
? moment(res[i].horaEntrega).format('HH:mm')
|
||||||
|
: '',
|
||||||
modulo: res[i].Equipo.Carrito.Modulo.modulo,
|
modulo: res[i].Equipo.Carrito.Modulo.modulo,
|
||||||
carrito: res[i].Equipo.Carrito.carrito,
|
carrito: res[i].Equipo.Carrito.carrito,
|
||||||
equipo: res[i].Equipo.equipo,
|
equipo: res[i].Equipo.equipo,
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
|
const { Op } = require('sequelize');
|
||||||
const Programa = require('../../db/tablas/Programa');
|
const Programa = require('../../db/tablas/Programa');
|
||||||
|
|
||||||
const get = async () => Programa.findAll();
|
const get = async () =>
|
||||||
|
Programa.findAll({
|
||||||
|
where: { [Op.or]: [{ idPrograma: 2 }, { idPrograma: 3 }] },
|
||||||
|
});
|
||||||
|
|
||||||
module.exports = get;
|
module.exports = get;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
const TipoCarrito = require('../../db/tablas/TipoCarrito');
|
const TipoCarrito = require('../../db/tablas/TipoCarrito');
|
||||||
|
|
||||||
const get = async () => TipoCarrito.findAll({ where: { idTipoCarrito: 1 } });
|
const get = async () => TipoCarrito.findAll();
|
||||||
|
|
||||||
module.exports = get;
|
module.exports = get;
|
||||||
|
|||||||
@@ -0,0 +1,145 @@
|
|||||||
|
const csv = require('csvtojson');
|
||||||
|
const helperPath = '../../helper';
|
||||||
|
const { validarObjetoVacio } = require(`${helperPath}/validar`);
|
||||||
|
const { eliminarArchivo } = require(`${helperPath}/helper`);
|
||||||
|
const dbPath = '../../db/tablas';
|
||||||
|
const Carrera = require(`${dbPath}/Carrera`);
|
||||||
|
const TipoUsuario = require(`${dbPath}/TipoUsuario`);
|
||||||
|
const Usuario = require(`${dbPath}/Usuario`);
|
||||||
|
|
||||||
|
const cargaMasiva = async (file) => {
|
||||||
|
const path = `server/uploads/${file}`;
|
||||||
|
const usuariosNuevos = [];
|
||||||
|
const usuariosUpdate = [];
|
||||||
|
const errores = [];
|
||||||
|
const avisos = [];
|
||||||
|
|
||||||
|
return csv()
|
||||||
|
.fromFile(path)
|
||||||
|
.then(async (usuarios) => {
|
||||||
|
for (let i = 0; i < usuarios.length; i++) {
|
||||||
|
const mensajeErrBase = `Se salto la linea ${i + 2} por:`;
|
||||||
|
|
||||||
|
if (
|
||||||
|
!usuarios[i].cuenta ||
|
||||||
|
!usuarios[i].apellidop ||
|
||||||
|
!usuarios[i].apellidom ||
|
||||||
|
!usuarios[i].nombrew ||
|
||||||
|
!usuarios[i].tipoUsuario
|
||||||
|
) {
|
||||||
|
if (!usuarios[i].cuenta)
|
||||||
|
errores.push(`${mensajeErrBase} falta variable cuenta.`);
|
||||||
|
if (!usuarios[i].apellidop)
|
||||||
|
errores.push(`${mensajeErrBase} falta variable apellidop.`);
|
||||||
|
if (!usuarios[i].apellidom)
|
||||||
|
errores.push(`${mensajeErrBase} falta variable apellidom.`);
|
||||||
|
if (!usuarios[i].nombrew)
|
||||||
|
errores.push(`${mensajeErrBase} falta variable nombrew.`);
|
||||||
|
if (!usuarios[i].tipoUsuario)
|
||||||
|
errores.push(`${mensajeErrBase} falta variable tipoUsuario.`);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const idTipoUsuario = await TipoUsuario.findOne({
|
||||||
|
where: { tipoUsuario: usuarios[i].tipoUsuario },
|
||||||
|
}).then((res) => {
|
||||||
|
if (!res) {
|
||||||
|
errores.push(`${mensajeErrBase} tipo de usuario no valido.`);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return res.idTipoUsuario;
|
||||||
|
});
|
||||||
|
let idCarrera = null;
|
||||||
|
|
||||||
|
if (!idTipoUsuario) continue;
|
||||||
|
if (idTipoUsuario != 3) {
|
||||||
|
if (!usuarios[i].nomplan) {
|
||||||
|
errores.push(`${mensajeErrBase} falta variable nomplan.`);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
idCarrera = await Carrera.findOne({
|
||||||
|
where: { carrera: usuarios[i].nomplan },
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
if (!res) {
|
||||||
|
avisos.push(
|
||||||
|
`Se añadio el posgrado/la carrera ${usuarios[i].nomplan} al catálogo.`
|
||||||
|
);
|
||||||
|
return Carrera.create({ carrera: usuarios[i].nomplan });
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
})
|
||||||
|
.then((res) => res.idCarrera);
|
||||||
|
}
|
||||||
|
if (usuarios[i].cuenta.length === 8)
|
||||||
|
usuarios[i].cuenta = `0${usuarios[i].cuenta}`;
|
||||||
|
await Usuario.findOne({
|
||||||
|
where: { usuario: usuarios[i].cuenta },
|
||||||
|
include: [{ model: Carrera }],
|
||||||
|
}).then(async (res) => {
|
||||||
|
let usuario = res;
|
||||||
|
|
||||||
|
if (!usuario) {
|
||||||
|
const data = {
|
||||||
|
usuario: usuarios[i].cuenta,
|
||||||
|
nombre: `${usuarios[i].apellidop} ${usuarios[i].apellidom} ${usuarios[i].nombrew}`,
|
||||||
|
idTipoUsuario,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (data.idTipoUsuario != 3) data.idCarrera = idCarrera;
|
||||||
|
await Usuario.create(data)
|
||||||
|
.then((res) =>
|
||||||
|
Usuario.findOne({
|
||||||
|
where: { idUsuario: res.idUsuario },
|
||||||
|
include: [{ model: Carrera }, { model: TipoUsuario }],
|
||||||
|
attributes: ['idUsuario', 'usuario', 'nombre'],
|
||||||
|
})
|
||||||
|
)
|
||||||
|
.then((res) => usuariosNuevos.push(res));
|
||||||
|
} else {
|
||||||
|
let update = {};
|
||||||
|
|
||||||
|
if (!usuario.activo) {
|
||||||
|
update.activo = true;
|
||||||
|
usuariosUpdate.push(
|
||||||
|
`La cuenta del usuario: ${usuario.usuario} fue activada.`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
usuario.Carrera &&
|
||||||
|
usuario.Carrera.carrera != usuarios[i].nomplan
|
||||||
|
) {
|
||||||
|
update.idCarrera = idCarrera;
|
||||||
|
usuariosUpdate.push(
|
||||||
|
`Se cambio la carrera del usuario: ${usuario.usuario} de ${usuario.Carrera.carrera} por ${usuarios[i].nomplan}.`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (usuario.idTipoUsuario != idTipoUsuario) {
|
||||||
|
update.idTipoUsuario = idTipoUsuario;
|
||||||
|
usuariosUpdate.push(
|
||||||
|
`Se cambio el tipo de usuario del usuario: ${usuario.usuario} de ${usuario.TipoUsuario.tipoUsuario} por ${usuarios[i].tipoUsuario}.`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (!validarObjetoVacio(update))
|
||||||
|
await Usuario.update(update, {
|
||||||
|
where: { idUsuario: usuario.idUsuario },
|
||||||
|
});
|
||||||
|
else
|
||||||
|
errores.push(
|
||||||
|
`${mensajeErrBase} no se mando nada para actualizar.`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return eliminarArchivo(path);
|
||||||
|
})
|
||||||
|
.then(() => ({
|
||||||
|
message: 'Se subió correctamente el archivo csv.',
|
||||||
|
usuariosNuevos,
|
||||||
|
usuariosUpdate,
|
||||||
|
errores,
|
||||||
|
avisos,
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = cargaMasiva;
|
||||||
@@ -1,126 +0,0 @@
|
|||||||
const csv = require('csvtojson');
|
|
||||||
const helperPath = '../../helper';
|
|
||||||
const { validarObjetoVacio } = require(`${helperPath}/validar`);
|
|
||||||
const { eliminarArchivo } = require(`${helperPath}/helper`);
|
|
||||||
const dbPath = '../../db/tablas';
|
|
||||||
const Carrera = require(`${dbPath}/Carrera`);
|
|
||||||
const TipoUsuario = require(`${dbPath}/TipoUsuario`);
|
|
||||||
const Usuario = require(`${dbPath}/Usuario`);
|
|
||||||
|
|
||||||
const cargaMasiva = async (file) => {
|
|
||||||
const path = `server/uploads/${file}`;
|
|
||||||
const alumnosNuevos = [];
|
|
||||||
const alumnosUpdate = [];
|
|
||||||
const errores = [];
|
|
||||||
const avisos = [];
|
|
||||||
|
|
||||||
await csv()
|
|
||||||
.fromFile(path)
|
|
||||||
.then(async (alumnos) => {
|
|
||||||
for (let i = 0; i < alumnos.length; i++) {
|
|
||||||
if (alumnos[i].cuenta.length === 8)
|
|
||||||
alumnos[i].cuenta = '0' + alumnos[i].cuenta;
|
|
||||||
await Usuario.findOne({
|
|
||||||
where: { usuario: alumnos[i].cuenta },
|
|
||||||
include: [{ model: Carrera }],
|
|
||||||
}).then(async (res) => {
|
|
||||||
let usuario = res;
|
|
||||||
|
|
||||||
if (!usuario) {
|
|
||||||
await Carrera.findOne({
|
|
||||||
where: { carrera: alumnos[i].nomplan },
|
|
||||||
})
|
|
||||||
.then((res) => {
|
|
||||||
if (!res) {
|
|
||||||
avisos.push(
|
|
||||||
`Se añadio el posgrado ${alumnos[i].nomplan} al catalogo.`
|
|
||||||
);
|
|
||||||
return Carrera.create({ carrera: alumnos[i].nomplan });
|
|
||||||
}
|
|
||||||
return res;
|
|
||||||
})
|
|
||||||
.then((res) =>
|
|
||||||
Usuario.create({
|
|
||||||
usuario: alumnos[i].cuenta,
|
|
||||||
nombre: `${alumnos[i].apellidop} ${alumnos[i].apellidom} ${alumnos[i].nombrew}`,
|
|
||||||
idCarrera: res.idCarrera,
|
|
||||||
idTipoUsuario: 5,
|
|
||||||
})
|
|
||||||
)
|
|
||||||
.then((res) =>
|
|
||||||
Usuario.findOne({
|
|
||||||
where: { idUsuario: res.idUsuario },
|
|
||||||
include: [{ model: Carrera }, { model: TipoUsuario }],
|
|
||||||
})
|
|
||||||
)
|
|
||||||
.then((res) => {
|
|
||||||
alumnosNuevos.push({
|
|
||||||
idUsuario: res.idUsuario,
|
|
||||||
usuario: res.usuario,
|
|
||||||
nombre: res.nombre,
|
|
||||||
Carrera: {
|
|
||||||
idCarrera: res.Carrera.idCarrera,
|
|
||||||
carrera: res.Carrera.carrera,
|
|
||||||
},
|
|
||||||
TipoUsuario: {
|
|
||||||
idTipoUsuario: res.TipoUsuario.idTipoUsuario,
|
|
||||||
tipoUsuario: res.TipoUsuario.tipoUsuario,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
let update = {};
|
|
||||||
|
|
||||||
if (!usuario.activo) {
|
|
||||||
update.activo = true;
|
|
||||||
alumnosUpdate.push(`El alumno ${usuario.usuario} fue activado.`);
|
|
||||||
}
|
|
||||||
if (usuario.Carrera.carrera != alumnos[i].nomplan) {
|
|
||||||
await Carrera.findOne({
|
|
||||||
where: { carrera: alumnos[i].nomplan },
|
|
||||||
})
|
|
||||||
.then((res) => {
|
|
||||||
if (!res) {
|
|
||||||
avisos.push(
|
|
||||||
`Se añadio el posgrado ${alumnos[i].nomplan} al catalogo.`
|
|
||||||
);
|
|
||||||
return Carrera.create({ carrera: alumnos[i].nomplan });
|
|
||||||
}
|
|
||||||
return res;
|
|
||||||
})
|
|
||||||
.then((res) => {
|
|
||||||
update.idCarrera = res.idCarrera;
|
|
||||||
alumnosUpdate.push(
|
|
||||||
`Se cambio la carrera del alumno ${usuario.usuario} de ${usuario.Carrera.carrera} por ${res.carrera}.`
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (usuario.idTipoUsuario === 3)
|
|
||||||
avisos.push(
|
|
||||||
`El alumno con id ${usuario.idUsuario} y numero de cuenta ${usuario.usuario} tambien es profesor.`
|
|
||||||
);
|
|
||||||
if (usuario.idTipoUsuario === 4) {
|
|
||||||
update.idTipoUsuario = 5;
|
|
||||||
alumnosUpdate.push(
|
|
||||||
`Se cambio el tipo de usuario alumno con id ${usuario.idUsuario} y numero de cuenta ${usuario.usuario}.`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (!validarObjetoVacio(update))
|
|
||||||
await Usuario.update(update, {
|
|
||||||
where: { idUsuario: usuario.idUsuario },
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
await eliminarArchivo(path);
|
|
||||||
});
|
|
||||||
return {
|
|
||||||
message: 'Se subió correctamente el archivo csv.',
|
|
||||||
alumnosNuevos,
|
|
||||||
alumnosUpdate,
|
|
||||||
errores,
|
|
||||||
avisos,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = cargaMasiva;
|
|
||||||
@@ -4,6 +4,7 @@ const helperPath = '../../helper';
|
|||||||
const { comparar } = require(`${helperPath}/encriptar`);
|
const { comparar } = require(`${helperPath}/encriptar`);
|
||||||
const validar = require(`${helperPath}/validar`);
|
const validar = require(`${helperPath}/validar`);
|
||||||
const dbPath = '../../db/tablas';
|
const dbPath = '../../db/tablas';
|
||||||
|
const Carrera = require(`${dbPath}/Carrera`);
|
||||||
const Usuario = require(`${dbPath}/Usuario`);
|
const Usuario = require(`${dbPath}/Usuario`);
|
||||||
const TipoUsuario = require(`${dbPath}/TipoUsuario`);
|
const TipoUsuario = require(`${dbPath}/TipoUsuario`);
|
||||||
|
|
||||||
@@ -27,7 +28,7 @@ const login = async (body) => {
|
|||||||
throw new Error('La contraseña es incorrecta.');
|
throw new Error('La contraseña es incorrecta.');
|
||||||
return Usuario.findOne({
|
return Usuario.findOne({
|
||||||
where: { usuario },
|
where: { usuario },
|
||||||
include: [{ model: TipoUsuario }],
|
include: [{ model: TipoUsuario }, { model: Carrera }],
|
||||||
attributes: ['idUsuario', 'usuario', 'nombre', 'multa', 'activo'],
|
attributes: ['idUsuario', 'usuario', 'nombre', 'multa', 'activo'],
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|||||||
+23
-11
@@ -6,6 +6,7 @@ const Carrito = require('./tablas/Carrito');
|
|||||||
const Equipo = require('./tablas/Equipo');
|
const Equipo = require('./tablas/Equipo');
|
||||||
const Infraccion = require('./tablas/Infraccion');
|
const Infraccion = require('./tablas/Infraccion');
|
||||||
const Modulo = require('./tablas/Modulo');
|
const Modulo = require('./tablas/Modulo');
|
||||||
|
const Motivo = require('./tablas/Motivo');
|
||||||
const Multa = require('./tablas/Multa');
|
const Multa = require('./tablas/Multa');
|
||||||
const Operador = require('./tablas/Operador');
|
const Operador = require('./tablas/Operador');
|
||||||
const Prestamo = require('./tablas/Prestamo');
|
const Prestamo = require('./tablas/Prestamo');
|
||||||
@@ -27,6 +28,9 @@ const drop = async () => {
|
|||||||
await Prestamo.drop();
|
await Prestamo.drop();
|
||||||
console.log('La tabla Prestamo se desinstalo correctamente.'.magenta);
|
console.log('La tabla Prestamo se desinstalo correctamente.'.magenta);
|
||||||
|
|
||||||
|
await Motivo.drop();
|
||||||
|
console.log('La tabla Motivo se desinstalo correctamente.'.magenta);
|
||||||
|
|
||||||
await Equipo.drop();
|
await Equipo.drop();
|
||||||
console.log('La tabla Equipo se desinstalo correctamente.'.magenta);
|
console.log('La tabla Equipo se desinstalo correctamente.'.magenta);
|
||||||
|
|
||||||
@@ -91,6 +95,9 @@ const sync = async () => {
|
|||||||
await Equipo.sync();
|
await Equipo.sync();
|
||||||
console.log('La tabla Equipo se instalo correctamente.'.magenta);
|
console.log('La tabla Equipo se instalo correctamente.'.magenta);
|
||||||
|
|
||||||
|
await Motivo.sync();
|
||||||
|
console.log('La tabla Motivo se instalo correctamente.'.magenta);
|
||||||
|
|
||||||
await Prestamo.sync();
|
await Prestamo.sync();
|
||||||
console.log('La tabla Prestamo se instalo correctamente.'.magenta);
|
console.log('La tabla Prestamo se instalo correctamente.'.magenta);
|
||||||
|
|
||||||
@@ -151,6 +158,8 @@ const dataStatus = async () => {
|
|||||||
'Cargando',
|
'Cargando',
|
||||||
'Reparación',
|
'Reparación',
|
||||||
'Mantenimiento',
|
'Mantenimiento',
|
||||||
|
'Desactivado',
|
||||||
|
'Revisar',
|
||||||
];
|
];
|
||||||
|
|
||||||
console.log('\nPaso 6) Insertando data status.'.bold.blue);
|
console.log('\nPaso 6) Insertando data status.'.bold.blue);
|
||||||
@@ -163,7 +172,7 @@ const dataStatus = async () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const dataPrograma = async () => {
|
const dataPrograma = async () => {
|
||||||
const data = ['Autocad, Maya, 3Dmax', 'Programación'];
|
const data = ['Autocad, Maya, 3Dmax', 'Programación', 'Autocad', '3Dmax'];
|
||||||
|
|
||||||
console.log('\nPaso 7) Insertando data programa.'.bold.blue);
|
console.log('\nPaso 7) Insertando data programa.'.bold.blue);
|
||||||
for (let i = 0; i < data.length; i++) {
|
for (let i = 0; i < data.length; i++) {
|
||||||
@@ -224,16 +233,19 @@ const dataInfraccion = async () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const exe = async () => {
|
const exe = async () => {
|
||||||
await drop();
|
// await drop();
|
||||||
await sync();
|
// await sync();
|
||||||
await dataTipoUsuario();
|
// await dataTipoUsuario();
|
||||||
await dataModulo();
|
// await dataModulo();
|
||||||
await dataTipoCarrito();
|
// await dataTipoCarrito();
|
||||||
await dataStatus();
|
// await dataStatus();
|
||||||
await dataPrograma();
|
// await dataPrograma();
|
||||||
await dataSystem();
|
// await dataSystem();
|
||||||
await dataAdmin();
|
// await dataAdmin();
|
||||||
await dataInfraccion();
|
// await dataInfraccion();
|
||||||
|
|
||||||
|
await Motivo.sync();
|
||||||
|
console.log('La tabla Motivo se instalo correctamente.'.magenta);
|
||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
'\nSe ha instalado exitosamente la base de datos.\n'.underline.bold.green
|
'\nSe ha instalado exitosamente la base de datos.\n'.underline.bold.green
|
||||||
|
|||||||
@@ -26,6 +26,11 @@ Equipo.init(
|
|||||||
type: DataTypes.STRING(15),
|
type: DataTypes.STRING(15),
|
||||||
allowNull: false,
|
allowNull: false,
|
||||||
},
|
},
|
||||||
|
prestado: {
|
||||||
|
type: DataTypes.BOOLEAN,
|
||||||
|
allowNull: false,
|
||||||
|
defaultValue: false,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
sequelize,
|
sequelize,
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
const { DataTypes, Model } = require('sequelize');
|
||||||
|
const sequelize = require('../../config/sequelize.conf');
|
||||||
|
const Equipo = require('./Equipo');
|
||||||
|
const Status = require('./Status');
|
||||||
|
|
||||||
|
class Motivo extends Model {}
|
||||||
|
Motivo.init(
|
||||||
|
{
|
||||||
|
idMotivo: {
|
||||||
|
type: DataTypes.INTEGER,
|
||||||
|
primaryKey: true,
|
||||||
|
allowNull: false,
|
||||||
|
unique: true,
|
||||||
|
autoIncrement: true,
|
||||||
|
},
|
||||||
|
motivo: {
|
||||||
|
type: DataTypes.STRING(500),
|
||||||
|
allowNull: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sequelize,
|
||||||
|
modelName: 'Motivo',
|
||||||
|
tableName: 'motivo',
|
||||||
|
timestamps: true,
|
||||||
|
createdAt: true,
|
||||||
|
updatedAt: false,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
Motivo.belongsTo(Equipo, {
|
||||||
|
foreignKey: {
|
||||||
|
name: 'idEquipo',
|
||||||
|
type: DataTypes.INTEGER,
|
||||||
|
allowNull: false,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
Motivo.belongsTo(Status, {
|
||||||
|
foreignKey: {
|
||||||
|
name: 'idStatus',
|
||||||
|
type: DataTypes.INTEGER,
|
||||||
|
allowNull: false,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = Motivo;
|
||||||
@@ -22,6 +22,11 @@ Multa.init(
|
|||||||
type: DataTypes.DATE,
|
type: DataTypes.DATE,
|
||||||
allowNull: false,
|
allowNull: false,
|
||||||
},
|
},
|
||||||
|
// activo: {
|
||||||
|
// type: DataTypes.BOOLEAN,
|
||||||
|
// allowNull: false,
|
||||||
|
// defaultValue: true,
|
||||||
|
// },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
sequelize,
|
sequelize,
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
const Equipo = require('../db/tablas/Equipo');
|
||||||
|
|
||||||
|
Equipo.update({ prestado: false }, { where: { prestado: true } });
|
||||||
@@ -13,7 +13,7 @@ const verificaToken = (req, res, next) => {
|
|||||||
let message = '';
|
let message = '';
|
||||||
|
|
||||||
if (err.message === 'invalid signature')
|
if (err.message === 'invalid signature')
|
||||||
message = 'El token no es valido. Inicia sesión de nuevo.';
|
message = 'Se termino el tiempo de tu sesión. Inicia sesión de nuevo.';
|
||||||
if (err.message === 'jwt expired')
|
if (err.message === 'jwt expired')
|
||||||
message = 'El token expiro. Inicia sesión de nuevo.';
|
message = 'El token expiro. Inicia sesión de nuevo.';
|
||||||
if (err.message === 'jwt malformed')
|
if (err.message === 'jwt malformed')
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
const express = require('express');
|
||||||
|
const app = express();
|
||||||
|
const { verificaToken } = require('../middleware/autentificacion');
|
||||||
|
const route = '/motivo';
|
||||||
|
const historialMotivosEquipo = require('../controller/Motivo/historialMotivosEquipo');
|
||||||
|
|
||||||
|
app.get(`${route}/historial_motivos_equipo`, verificaToken, (req, res) => {
|
||||||
|
return historialMotivosEquipo(req.query)
|
||||||
|
.then((data) => {
|
||||||
|
res.status(200).json(data);
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
res.status(400).json({ message: err.message });
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = app;
|
||||||
@@ -5,7 +5,7 @@ const upload = multer({ dest: 'server/uploads' });
|
|||||||
const { verificaToken } = require('../middleware/autentificacion');
|
const { verificaToken } = require('../middleware/autentificacion');
|
||||||
const route = '/usuario';
|
const route = '/usuario';
|
||||||
const controllerPath = '../controller/Usuario';
|
const controllerPath = '../controller/Usuario';
|
||||||
const cargaMasivaPosgrados = require(`${controllerPath}/cargaMasivaPosgrados`);
|
const cargaMasiva = require(`${controllerPath}/cargaMasiva`);
|
||||||
const crear = require(`${controllerPath}/crear`);
|
const crear = require(`${controllerPath}/crear`);
|
||||||
const escolares = require(`${controllerPath}/escolares`);
|
const escolares = require(`${controllerPath}/escolares`);
|
||||||
const login = require(`${controllerPath}/login`);
|
const login = require(`${controllerPath}/login`);
|
||||||
@@ -19,7 +19,7 @@ app.post(
|
|||||||
upload.single('csv'),
|
upload.single('csv'),
|
||||||
(req, res) => {
|
(req, res) => {
|
||||||
if (req.file) {
|
if (req.file) {
|
||||||
return cargaMasivaPosgrados(req.file.filename)
|
return cargaMasiva(req.file.filename)
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
res.status(201).json(data);
|
res.status(201).json(data);
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ app.use(require('./Carrito'));
|
|||||||
app.use(require('./Equipo'));
|
app.use(require('./Equipo'));
|
||||||
app.use(require('./Infraccion'));
|
app.use(require('./Infraccion'));
|
||||||
app.use(require('./Modulo'));
|
app.use(require('./Modulo'));
|
||||||
|
app.use(require('./Motivo'));
|
||||||
app.use(require('./Multa'));
|
app.use(require('./Multa'));
|
||||||
app.use(require('./Operador'));
|
app.use(require('./Operador'));
|
||||||
app.use(require('./Prestamo'));
|
app.use(require('./Prestamo'));
|
||||||
|
|||||||
+4
-4
@@ -6,10 +6,10 @@ module.exports = {
|
|||||||
io = new Server(httpServer, {
|
io = new Server(httpServer, {
|
||||||
cors: {
|
cors: {
|
||||||
origin: [
|
origin: [
|
||||||
'http://localhost:3046',
|
// 'http://localhost:3046',
|
||||||
'http://localhost:3056',
|
// 'http://localhost:3056',
|
||||||
// 'http://132.248.80.196:3045',
|
'http://132.248.80.196:3045',
|
||||||
// 'http://132.248.80.196:3055',
|
'http://132.248.80.196:3055',
|
||||||
// 'https://pcpuma.acatlan.unam.mx',
|
// 'https://pcpuma.acatlan.unam.mx',
|
||||||
// 'https://pcpuma.acatlan.unam.mx:8080',
|
// 'https://pcpuma.acatlan.unam.mx:8080',
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user