This commit is contained in:
David Arranz 2019-08-30 19:47:28 +02:00
parent 5bf09a4caa
commit efd1a22bd9
2 changed files with 38 additions and 2 deletions

View File

@ -104,6 +104,7 @@ console.log(params);
const qrConfig = {
name: req.user.name,
surname: req.user.surname,
inscription: inscription.date,
code: inscription.code_ticket,
color: (inscription.level && inscription.level.color) ? inscription.level.color : null,
}
@ -499,6 +500,7 @@ console.log(headerMail, bodyMail);
const qrConfig = {
name: req.user.name,
surname: req.user.surname,
date: inscription.date,
code: inscription.code_ticket,
color: (inscription.level && inscription.level.color) ? inscription.level.color : null,
}
@ -509,7 +511,35 @@ console.log(headerMail, bodyMail);
} catch (error) {
return handleResultResponse("Error al buscar la inscripción", null, params, res, httpStatus.NOT_FOUND);
}
},
sendMailTicket: async (req, res, next) => {
const params = extractParamsFromRequest(req, res, {});
const inscriptionId = params.params.id;
const userId = req.user.id;
try {
/*
const inscription = await eventInscriptionService._getInscriptionById(inscriptionId);
if (!inscription) {
return handleResultResponse("Inscription no encontrada", null, params, res, httpStatus.NOT_FOUND);
} else if (inscription.userId !== userId) {
return handleResultResponse("Inscription no encontrada", null, params, res, httpStatus.NOT_FOUND);
}
const qrConfig = {
name: req.user.name,
surname: req.user.surname,
date: inscription.date,
code: inscription.code_ticket,
color: (inscription.level && inscription.level.color) ? inscription.level.color : null,
}
const qrCode = await QRHelper.getInscriptionQRCode(qrConfig);
*/
return handleResultResponse(null, null, params, res, httpStatus.OK);
} catch (error) {
return handleResultResponse("Error al buscar la inscripción", null, params, res, httpStatus.NOT_FOUND);
}
},

View File

@ -175,11 +175,17 @@ routes.get('/me/inscriptions/:id',
);
// Inscription QR Code
routes.get('/me/inscriptions/:id/qr', isLoggedUser,
//routes.get('/me/inscriptions/:id/qr', isLoggedUser,
//cacheSuccesses('1 hour'),
eventController.getQRCodeInscription,
// eventController.getQRCodeInscription,
//);
routes.get('/me/inscriptions/:id/mail',
isLoggedUser,
//cacheSuccesses('1 hour'),
eventController.sendMailTicket,
);
/*router.get('/:conferenceId/inscription/:userId/qrimage', function (req, res) {
conference.getInscriptionQRCode(req.params.conferenceId, req.params.userId, function (result, status) {
if (result && result.data) {