.
This commit is contained in:
parent
c22a469ae5
commit
5f4b7fc3f9
@ -147,23 +147,19 @@ const extraControllers = {
|
||||
const userId = req.user.id;
|
||||
var result = null;
|
||||
|
||||
//console.log('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>', params, req.user.level);
|
||||
if (!eventId)
|
||||
return handleResultResponse("Es necesario el ID del evento", null, params, res, httpStatus.NOT_FOUND);
|
||||
|
||||
|
||||
try {
|
||||
if (req.user.level === 8) result = await eventInscriptionService._getInscriptionOnlineByEvent(eventId);
|
||||
result = await eventInscriptionService._getInscriptionOnlineByEvent(eventId);
|
||||
//No se le llamará nunca desde la app, la app trata todas las incripciopnes como normales
|
||||
// else result = await eventInscriptionService._getInscriptionByEventAndUser(eventId, userId);
|
||||
|
||||
return handleResultResponse(result, null, params, res, result === null ? httpStatus.NOT_FOUND : httpStatus.OK);
|
||||
} catch (error) {
|
||||
return handleErrorResponse(MODULE_NAME, "getInscriptionsOnline", error, res);
|
||||
}
|
||||
|
||||
|
||||
|
||||
},
|
||||
|
||||
|
||||
|
||||
@ -4,9 +4,9 @@ const eventInscriptionService = require("./events_inscriptions.service");
|
||||
const marketing = require("../../helpers/sendinblue.helper");
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// dataInscription {incription:{...}, {..., event:{...}, reservation:{...}, user:{...}}
|
||||
// dataInscription {incription:{...}, event:{...}, reservation:{...}, user:{...}}
|
||||
////////////////////////////////////////////////////////////////////
|
||||
/*AHORA SE ALMACENA TODO EN UNA ÚNICA LISTA DE MAILCHIMP, QUE ES LA DEL EVENTO
|
||||
/*AHORA SE ALMACENA TODO EN UNA ÚNICA LISTA DE MAILCHIMP, QUE ES LA DEL EVENTO
|
||||
(si en un futuro se quiere tener listas independientes, bastaría con tratarlo aqui los campos de marketinglist de la reserva ...)
|
||||
if (dataInscription.inscription.reservationId)
|
||||
marketingListOfInscription = dataInscription.reservation.marketingList
|
||||
@ -17,10 +17,10 @@ const marketing = require("../../helpers/sendinblue.helper");
|
||||
*/
|
||||
function _generateMarketingDTO(dataInscription) {
|
||||
let inscriptionDTO = {};
|
||||
|
||||
console.log('entro>>> ', dataInscription);
|
||||
let inscription = dataInscription.inscription ? dataInscription.inscription : dataInscription;
|
||||
|
||||
console.log('entro>>>', inscription);
|
||||
console.log('inscripción>>> ', inscription);
|
||||
if (inscription) {
|
||||
inscriptionDTO.id = inscription.id;
|
||||
inscriptionDTO.source = inscription.source;
|
||||
@ -34,12 +34,12 @@ function _generateMarketingDTO(dataInscription) {
|
||||
inscriptionDTO.reservation_code = inscription.reservation ? inscription.reservation.reservation_code : null;
|
||||
inscriptionDTO.color = inscription.reservation ? inscription.reservation.color : null;
|
||||
inscriptionDTO.description = (inscription.reservation ? inscription.reservation.description : "Entrada").toUpperCase();
|
||||
inscriptionDTO.qrConfig= null;
|
||||
inscriptionDTO.qrCode= null;
|
||||
inscriptionDTO.qrConfig = null;
|
||||
inscriptionDTO.qrCode = null;
|
||||
|
||||
if (inscription.user) {
|
||||
//Era para mailchimp
|
||||
/// inscriptionDTO.marketing_memberId = inscription.marketing_memberId ? inscription.marketing_memberId : null;
|
||||
//Era para mailchimp
|
||||
/// inscriptionDTO.marketing_memberId = inscription.marketing_memberId ? inscription.marketing_memberId : null;
|
||||
inscriptionDTO.email = inscription.user.email;
|
||||
inscriptionDTO.name = inscription.user.name;
|
||||
inscriptionDTO.surname = inscription.user.surname;
|
||||
@ -57,7 +57,7 @@ function sleep(time) {
|
||||
}
|
||||
|
||||
|
||||
async function _addMember (inscriptionDTO) {
|
||||
async function _addMember(inscriptionDTO) {
|
||||
console.debug('>>>> _addMember', inscriptionDTO.email);
|
||||
console.debug('>>>> event_marketing_list', inscriptionDTO.event_marketing_list);
|
||||
// console.debug(member);
|
||||
@ -77,9 +77,9 @@ async function _addMember (inscriptionDTO) {
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async function _deleteMember (idLista, email) {
|
||||
async function _deleteMember(idLista, email) {
|
||||
console.debug(
|
||||
"Elimino miembro de la lista de marketing>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<",
|
||||
email,
|
||||
@ -93,7 +93,7 @@ async function _addMember (inscriptionDTO) {
|
||||
resolve(marketing.deleteMember(idLista, email));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async function addMarketingList(dataUser, dataInscription) {
|
||||
@ -105,7 +105,7 @@ async function addMarketingList(dataUser, dataInscription) {
|
||||
|
||||
|
||||
|
||||
async function syncronizeEventWithMarketingList (eventId) {
|
||||
async function syncronizeEventWithMarketingList(eventId) {
|
||||
let result = false;
|
||||
try {
|
||||
let inscriptionsToSync = await eventInscriptionService._getInscriptionsWithoutMemberId(eventId);
|
||||
@ -118,9 +118,9 @@ async function syncronizeEventWithMarketingList (eventId) {
|
||||
|
||||
sleep(1000 * i).then(function () {
|
||||
let inscriptionDTO = _addMember(_generateMarketingDTO(item));
|
||||
// let marketingDTO = _generateMarketingDTO(item);
|
||||
// console.log(marketingDTO)
|
||||
// _deleteMember(marketingDTO.event_marketing_list, marketingDTO.email)
|
||||
// let marketingDTO = _generateMarketingDTO(item);
|
||||
// console.log(marketingDTO)
|
||||
// _deleteMember(marketingDTO.event_marketing_list, marketingDTO.email)
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user