listo socket

This commit is contained in:
xXpuma99Xx
2022-01-25 22:08:13 -06:00
parent e8f9a96ecf
commit 833dc127be
12 changed files with 81 additions and 115 deletions
+9 -8
View File
@@ -1,3 +1,4 @@
const moment = require('moment');
const { convertArrayToCSV } = require('convert-array-to-csv');
const { Op } = require('sequelize');
const helperPath = '../../helper';
@@ -95,12 +96,14 @@ const reporte = async (body) => {
data.push({
idPrestamo: res[i].idPrestamo,
activo: res[i].activo,
horaMaxRecoger: helper.crearDDMMAAAAHHMM(res[i].horaMaxRecoger),
horaInicio: helper.crearDDMMAAAAHHMM(res[i].horaInicio),
horaFin: helper.crearDDMMAAAAHHMM(res[i].horaFin),
horaEntrega: helper.crearDDMMAAAAHHMM(res[i].horaEntrega),
horaMaxRecoger: moment(res[i].horaMaxRecoger).format(
'YYYY-MM-DD HH:MM'
),
horaInicio: moment(res[i].horaInicio).format('YYYY-MM-DD HH:MM'),
horaFin: moment(res[i].horaFin).format('YYYY-MM-DD HH:MM'),
horaEntrega: moment(res[i].horaEntrega).format('YYYY-MM-DD HH:MM'),
canceladoUsuario: res[i].canceladoUsuario,
createdAt: helper.crearDDMMAAAAHHMM(res[i].createdAt),
createdAt: moment(res[i].createdAt).format('YYYY-MM-DD HH:MM'),
numeroInventario: res[i].Equipo.numeroInventario,
numeroSerie: res[i].Equipo.numeroSerie,
sobrenombre: res[i].Equipo.sobrenombre,
@@ -125,9 +128,7 @@ const reporte = async (body) => {
: null,
});
}
await helper.eliminarArchivo(path).catch((err) => {
console.log(err);
});
await helper.eliminarArchivo(path).catch((err) => {});
return helper.crearArchivo(path, convertArrayToCSV(data));
})
.then((res) => path);