.
This commit is contained in:
parent
a2d2d7fb58
commit
664c8e5271
@ -17,54 +17,6 @@ const controllerOptions = { MODULE_NAME };
|
||||
|
||||
const extraControllers = {
|
||||
|
||||
sendNotificationEvent: async (req, res, next) => {
|
||||
|
||||
|
||||
let usersIds = null;
|
||||
const params = req.body;
|
||||
const eventId = params.recipients.eventId;
|
||||
const segment = params.recipients.segment;
|
||||
console.log('prueba de llamada>>>>> ', params);
|
||||
|
||||
try {
|
||||
notificationService.createNotification(params.date, params.title, params.message, undefined, 'default', params.data, req.user.id);
|
||||
switch (segment) {
|
||||
//Todos los inscritos al evento tanto en validos como en lista de espera
|
||||
case 'ALL':
|
||||
usersIds = await eventInscriptionService._getInscriptionByEvent(eventId);
|
||||
break;
|
||||
//Todos los inscritos tanto invitados como libres
|
||||
case 'ALL_VALIDATED':
|
||||
usersIds = await eventInscriptionService._getInscriptionByEventAndValidated(eventId, true);
|
||||
break;
|
||||
//Todos los de lista de espera tanto invitados como libres (Actualmente en invitados no hay lista de espera)
|
||||
case 'ALL_NOT_VALIDATED':
|
||||
usersIds = await eventInscriptionService._getInscriptionByEventAndValidated(eventId, false);
|
||||
break;
|
||||
|
||||
//Solo invitados como actualmente no se usa codigo de reserva para los coles, vale con filtrar por aquellos que tengan codigo de reserva
|
||||
case 'PARTNERS_ALL':
|
||||
usersIds = await eventInscriptionService._getInscriptionByEventFromPartner(eventId);
|
||||
|
||||
break;
|
||||
|
||||
//Todos los inscritos al evento, tanto validados como en lista de espera
|
||||
default: //ALL
|
||||
break;
|
||||
}
|
||||
|
||||
usersIds = usersIdsComposer(usersIds);
|
||||
console.log('usuarios inscritos>>>>> ', usersIds);
|
||||
|
||||
} catch(error) {
|
||||
return handleErrorResponse(MODULE_NAME, 'sendNotificationEvent', error, res);
|
||||
}
|
||||
|
||||
|
||||
|
||||
return handleResultResponse("sendNotificationEvent", null, params, res, httpStatus.OK);
|
||||
},
|
||||
|
||||
sendNotification: (config) => {
|
||||
|
||||
/**
|
||||
@ -173,6 +125,8 @@ const extraControllers = {
|
||||
data: body.data,
|
||||
userId: context.user.id,
|
||||
};
|
||||
console.log('--------------------');
|
||||
console.log(notificationRecord);
|
||||
|
||||
let buildMessagesPromise = (userDevices) => {
|
||||
return new Promise(function (resolve) {
|
||||
|
||||
@ -20,6 +20,8 @@ const pushSendEvent = Joi.object().keys({
|
||||
eventId: Joi.string().optional(),
|
||||
segment: Joi.string().optional(),
|
||||
}),
|
||||
priority: Joi.string().optional(),
|
||||
ttl: Joi.string().optional(),
|
||||
data: Joi.object().keys({
|
||||
type: Joi.string().required(),
|
||||
title: Joi.string().required(),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user