Agregue exension a la base de datos

This commit is contained in:
Andres2908
2022-02-09 16:27:21 -06:00
parent e60911447e
commit a157df8966
10 changed files with 11 additions and 3 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 129 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 129 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 129 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 998 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 998 KiB

+2 -2
View File
@@ -6,9 +6,9 @@ const Inscripcion = require(`${dbPath}/Inscripcion`);
const ticket = async (body) => {
return Inscripcion.findOne({
where: { folio: body.folio },
attributes: ['rutaTicket'],
attributes: ['rutaTicket', 'extension'],
}).then((res) => {
return res.rutaTicket;
return { rutaTicket: res.rutaTicket, extension: res.extension };
});
};
@@ -33,6 +33,7 @@ const inscripcion = async (body, file) => {
fechaInscripcion: ahora.format(),
fechaTicket: body.fechaTicket,
rutaTicket: file.path,
extension: file.mimetype.split('/')[1],
});
} else {
return Inscripcion.create({
+4
View File
@@ -50,6 +50,10 @@ Inscripcion.init(
allowNull: true,
defaultValue: null,
},
extension: {
type: DataTypes.STRING(6),
allowNull: false,
},
},
{
sequelize,
+4 -1
View File
@@ -34,7 +34,10 @@ 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);
console.log(data);
fs.createReadStream(
process.cwd() + '/' + data.rutaTicket + '.' + data.extension
).pipe(res);
// res.status(200).json(data);
})
.catch((err) => {