guardamos y emitimos la imagen
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 129 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 86 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 998 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 998 KiB |
@@ -0,0 +1,15 @@
|
||||
// const validar = require('../../../helper/validar');
|
||||
const dbPath = '../../db/tablas';
|
||||
const Usuario = require(`${dbPath}/Usuario`);
|
||||
const Inscripcion = require(`${dbPath}/Inscripcion`);
|
||||
|
||||
const ticket = async (body) => {
|
||||
return Inscripcion.findOne({
|
||||
where: { folio: body.folio },
|
||||
attributes: ['rutaTicket'],
|
||||
}).then((res) => {
|
||||
return res.rutaTicket;
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = ticket;
|
||||
@@ -8,7 +8,7 @@ const todasInscripciones = async (body) => {
|
||||
include: [
|
||||
{
|
||||
model: Usuario,
|
||||
attributes: ['numeroCuenta'],
|
||||
attributes: ['idUsuario', 'numeroCuenta'],
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
const express = require('express');
|
||||
const ticket = require('../controller/Admin/ticket');
|
||||
const app = express();
|
||||
const fs = require('fs');
|
||||
const route = '/Admin';
|
||||
const controllerPath = '../controller/Admin';
|
||||
const todasInscripciones = require(`${controllerPath}/todasInscripciones`);
|
||||
@@ -14,4 +16,16 @@ app.get(`${route}/todas_inscripciones`, (req, res) => {
|
||||
});
|
||||
});
|
||||
|
||||
app.get(`${route}/ticket`, (req, res) => {
|
||||
return ticket(req.query)
|
||||
.then((data) => {
|
||||
res.writeHead(200, { 'content-type': `image/png` });
|
||||
fs.createReadStream(process.cwd() + '/' + data + '.jpeg').pipe(res);
|
||||
// res.status(200).json(data);
|
||||
})
|
||||
.catch((err) => {
|
||||
res.status(400).json({ message: err.message });
|
||||
});
|
||||
});
|
||||
|
||||
module.exports = app;
|
||||
|
||||
@@ -2,7 +2,7 @@ const express = require('express');
|
||||
const app = express();
|
||||
const fs = require('fs');
|
||||
const multer = require('multer');
|
||||
const upload = multer({ dest: 'tickets/images' });
|
||||
const upload = multer({ dest: 'images' });
|
||||
const { verificaToken } = require('../middleware/autentificacion');
|
||||
const route = '/Usuario';
|
||||
const controllerPath = '../controller/Usuario';
|
||||
|
||||
Reference in New Issue
Block a user