From fe3d5c4f91945c5f5d4c3ac691979c2c3b7a138a Mon Sep 17 00:00:00 2001 From: Andres2908 Date: Thu, 10 Feb 2022 00:44:23 -0600 Subject: [PATCH] Seleccion en la tabla --- server/controller/Admin/todasInscripciones.js | 2 ++ server/controller/Admin/validarTicket.js | 2 +- server/controller/Usuario/inscripcionUsuario.js | 3 ++- server/db/tablas/Inscripcion.js | 5 ++--- server/routes/Admin.js | 1 - server/uploads/reporte.csv | 10 ++++++---- 6 files changed, 13 insertions(+), 10 deletions(-) diff --git a/server/controller/Admin/todasInscripciones.js b/server/controller/Admin/todasInscripciones.js index 2479cab..43e631d 100644 --- a/server/controller/Admin/todasInscripciones.js +++ b/server/controller/Admin/todasInscripciones.js @@ -1,10 +1,12 @@ const validar = require('../../helper/validar'); +const { Op } = require('sequelize'); const dbPath = '../../db/tablas'; const Usuario = require(`${dbPath}/Usuario`); const Inscripcion = require(`${dbPath}/Inscripcion`); const todasInscripciones = async (body) => { return Inscripcion.findAll({ + where: { validacion: body.validacion }, include: [ { model: Usuario, diff --git a/server/controller/Admin/validarTicket.js b/server/controller/Admin/validarTicket.js index fd64133..3ded65d 100644 --- a/server/controller/Admin/validarTicket.js +++ b/server/controller/Admin/validarTicket.js @@ -21,7 +21,7 @@ const validarTicket = async (body) => { }) .then((res) => { console.log(body.validacion); - if (body.validacion === false) + if (body.validacion === 0) throw new Error('El administrador a declinado el ticket'); }) .then((res) => ({ diff --git a/server/controller/Usuario/inscripcionUsuario.js b/server/controller/Usuario/inscripcionUsuario.js index 829cf49..2e0a35a 100644 --- a/server/controller/Usuario/inscripcionUsuario.js +++ b/server/controller/Usuario/inscripcionUsuario.js @@ -49,7 +49,8 @@ const inscripcion = async (body, file) => { fs.renameSync(file.path, file.path + '.' + file.mimetype.split('/')[1]); }) .then((res) => ({ - message: '¡La inscripción se realizo de manera correcta!', + message: + '¡La inscripción se realizo de manera correcta! Confirma en el siguiente sitio web tu inscripción: Kalinga', })) .catch((err) => { if (file) eliminarArchivo(file.path); diff --git a/server/db/tablas/Inscripcion.js b/server/db/tablas/Inscripcion.js index 5d1587b..3d22b33 100644 --- a/server/db/tablas/Inscripcion.js +++ b/server/db/tablas/Inscripcion.js @@ -15,9 +15,8 @@ Inscripcion.init( autoIncrement: true, }, validacion: { - type: DataTypes.BOOLEAN, - allowNull: true, - defaultValue: null, + type: DataTypes.INTEGER, + defaultValue: 2, }, confirmacion: { type: DataTypes.BOOLEAN, diff --git a/server/routes/Admin.js b/server/routes/Admin.js index 77ee4dd..0958d4f 100644 --- a/server/routes/Admin.js +++ b/server/routes/Admin.js @@ -34,7 +34,6 @@ app.get(`${route}/ticket`, (req, res) => { return ticket(req.query) .then((data) => { res.writeHead(200, { 'content-type': `image/png` }); - console.log(data); fs.createReadStream( process.cwd() + '/' + data.rutaTicket + '.' + data.extension ).pipe(res); diff --git a/server/uploads/reporte.csv b/server/uploads/reporte.csv index e909895..f6461fe 100644 --- a/server/uploads/reporte.csv +++ b/server/uploads/reporte.csv @@ -1,5 +1,7 @@ idInscripcion,validacion,confirmacion,folio,monto,fechaInscripcion,idArea -1,false,false,7410,12,Thu Feb 03 2022 22:45:50 GMT-0600 (hora estándar central),1 -2,true,false,9630,85,Thu Feb 03 2022 22:55:00 GMT-0600 (hora estándar central),3 -3,true,false,8520,89,Fri Feb 04 2022 22:51:02 GMT-0600 (hora estándar central),1 -4,"",false,9654,89,Fri Feb 04 2022 23:19:48 GMT-0600 (hora estándar central),3 +1,"",false,7410,1,Wed Feb 09 2022 21:28:01 GMT-0600 (hora estándar central),3 +2,"",false,8555,98,Wed Feb 09 2022 21:30:16 GMT-0600 (hora estándar central),1 +3,"",false,5555,6,Wed Feb 09 2022 21:30:48 GMT-0600 (hora estándar central),1 +4,"",false,7899,63,Wed Feb 09 2022 21:31:00 GMT-0600 (hora estándar central),3 +5,"",false,7778,8,Wed Feb 09 2022 21:45:45 GMT-0600 (hora estándar central),1 +6,"",false,9898,6633,Wed Feb 09 2022 21:46:01 GMT-0600 (hora estándar central),3