Merge branch 'master' of wopr.rodax-software.com:lqdvi/app2-api
This commit is contained in:
commit
3dfaf4b32c
@ -40,11 +40,13 @@ function send(header, body) {
|
||||
})
|
||||
request
|
||||
.then((result) => {
|
||||
console.log(result.body)
|
||||
console.log('EEEEEEEEEEEEEEEEEEEENNNNNNNNNNNNNNNNNNVIO correo>>>>');
|
||||
console.log(result.body);
|
||||
return result;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error.statusCode)
|
||||
console.log(error.statusCode);
|
||||
console.log(error);
|
||||
return error;
|
||||
})
|
||||
};
|
||||
@ -78,7 +80,7 @@ function sendTicket(header, values) {
|
||||
"codeTicket": values.codeTicket,
|
||||
"eventName": values.eventName,
|
||||
"dateInscription": values.dateInscription,
|
||||
"color": values.color,
|
||||
"color": (values.color)? values.color : 'gray',
|
||||
}
|
||||
};
|
||||
|
||||
@ -99,7 +101,7 @@ function sendListaEspera(header, values) {
|
||||
"tipoEntrada": values.tipoEntrada,
|
||||
"eventName": values.eventName,
|
||||
"dateInscription": values.dateInscription,
|
||||
"color": values.color,
|
||||
"color": (values.color) ? values.color : 'gray',
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -34,7 +34,7 @@ const extraControllers = {
|
||||
|
||||
try {
|
||||
const result = await eventReservationService._getReservaByCode(eventId, registrationCode);
|
||||
return handleResultResponse(!!result, null, params, res, (result === null) ? httpStatus.NOT_FOUND : httpStatus.OK);
|
||||
return handleResultResponse(!!result, null, params, res, httpStatus.OK);
|
||||
} catch(error) {
|
||||
return handleErrorResponse(MODULE_NAME, 'checkReservationCode', error, res)
|
||||
}
|
||||
@ -199,7 +199,7 @@ console.log('>>>>>>>>>>>>>>Voy a actualizar aforo evento');
|
||||
//Esta función se puede llamar desde APP y desde WEB
|
||||
createInscription: async(req, res, next) => {
|
||||
const params = extractParamsFromRequest(req, res, {});
|
||||
|
||||
console.log('CREATE INSCRIPTION>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>< ', params);
|
||||
//Iniciamos entidades relacionadas con la inscripción.
|
||||
let dataUser = {
|
||||
id: (req.user) ? req.user.id : null,
|
||||
@ -391,16 +391,22 @@ console.log('actualizo confirmados de la nueva reserva');
|
||||
dataInscription.validated = false;
|
||||
|
||||
//Actualizamos aforo de la lista de espera del evento y creamos inscripcion
|
||||
if (await eventService._updateConfirmedEvent(dataInscription.event.overflow_eventId, dataInscription.inscriptionsWithoutReservationCount))
|
||||
console.log('evento de lista de espera que debo actulizar sus confirmados>>>>>>>>>>>>>>>>>>>>>', dataInscription.event.overflow_eventId);
|
||||
console.log('cantidad>>>>>>>>>>>>>>>>>>>>>', dataInscription.inscriptionsWithoutReservationCount);
|
||||
if (await eventService._updateConfirmedEvent(dataInscription.event.overflow_eventId, dataInscription.inscriptionsWithoutReservationCount)) {
|
||||
console.log('voy a crearrrrrr la inscripcion');
|
||||
dataInscription.inscription = await eventInscriptionService._createInscription(dataInscription.event.id,
|
||||
dataUser.userResult.user.id,
|
||||
dataInscription.type,
|
||||
dataInscription.validated,
|
||||
dataInscription.source,
|
||||
null,
|
||||
dataInscription.event.overflow_eventId)
|
||||
else
|
||||
dataInscription.event.overflow_eventId);
|
||||
}
|
||||
else {
|
||||
console.log('No se ha podido actualizar el aforo del evento');
|
||||
return handleResultResponse("No se ha podido actualizar el aforo del evento", null, params, res, httpStatus.NOT_FOUND);
|
||||
}
|
||||
}
|
||||
else
|
||||
return handleResultResponse("Aforo completo y no hay lista de espera", null, params, res, httpStatus.NOT_FOUND);
|
||||
@ -444,9 +450,13 @@ console.log('actualizo confirmados de la nueva reserva');
|
||||
|
||||
console.log('member a añadir a mailchimp y envio correo');
|
||||
console.log(member);
|
||||
|
||||
member.marketing_memberId = await eventInscriptionService._addMember(marketingListOfInscription, member);
|
||||
eventInscriptionService._updateMarketingMemberOfInscription(dataInscription.inscription.id, member.marketing_memberId);
|
||||
try
|
||||
{
|
||||
member.marketing_memberId = await eventInscriptionService._addMember(marketingListOfInscription, member);
|
||||
eventInscriptionService._updateMarketingMemberOfInscription(dataInscription.inscription.id, member.marketing_memberId);
|
||||
} catch (error) {
|
||||
console.log('No se ha podido añadir email a mailchimp');
|
||||
};
|
||||
|
||||
|
||||
//MADAMOS MAIL CON LA ENTRADA
|
||||
@ -474,12 +484,19 @@ console.log(member);
|
||||
eventName: dataInscription.event.name,
|
||||
dateInscription: moment(dataInscription.event.init_date).format('D [de] MMMM [de] YYYY'),
|
||||
}
|
||||
|
||||
console.log('Mandamos mail con entrada>>>>>>>>>>>>>>>>>>>>>>>>>>>');
|
||||
console.log(headerMail, bodyMail);
|
||||
if (member.validated)
|
||||
emailHelper.sendTicket(headerMail, bodyMail)
|
||||
else
|
||||
emailHelper.sendListaEspera(headerMail, bodyMail);
|
||||
|
||||
try
|
||||
{
|
||||
if (member.validated)
|
||||
emailHelper.sendTicket(headerMail, bodyMail)
|
||||
else
|
||||
emailHelper.sendListaEspera(headerMail, bodyMail);
|
||||
} catch (error) {
|
||||
console.log('No se ha podido mandar email con entrada');
|
||||
};
|
||||
|
||||
return handleResultResponse(await dataInscription.inscription.toJSON(), null, params, res, httpStatus.CREATED)
|
||||
},
|
||||
|
||||
@ -52,13 +52,14 @@ const extraMethods = {
|
||||
confirmed: confirmed,
|
||||
},
|
||||
{
|
||||
where: { id: eventId }
|
||||
where: { id: eventId, typeId: { [Sequelize.Op.ne]: null} }
|
||||
})
|
||||
.then(function (result) {
|
||||
//const aaa = result[0];
|
||||
//console.log('aaaaaaaaaaaaaaaaaaaaaaaaaaa');
|
||||
//console.log(aaa);
|
||||
resolve((result[0] === 1));
|
||||
console.log('>>>>>>>>>>>>>>>>>>>>>>>>><resultado _updateConfirmedEvent', result);
|
||||
if (result)
|
||||
resolve((result[0] === 1))
|
||||
else
|
||||
resolve(false);
|
||||
})
|
||||
.catch(function (error) {
|
||||
reject(error)
|
||||
@ -76,10 +77,11 @@ const extraMethods = {
|
||||
where: { id: eventId }
|
||||
})
|
||||
.then(function (result) {
|
||||
//const aaa = result[0];
|
||||
//console.log('aaaaaaaaaaaaaaaaaaaaaaaaaaa');
|
||||
//console.log(aaa);
|
||||
resolve((result[0] === 1));
|
||||
console.log('>>>>>>>>>>>>>>>>>>>>>>>>><resultado _updateSoldOutEvent', result);
|
||||
if (result)
|
||||
resolve((result[0] === 1))
|
||||
else
|
||||
resolve(false);
|
||||
})
|
||||
.catch(function (error) {
|
||||
reject(error)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user