Revisión de notificaciones
This commit is contained in:
parent
7702da6267
commit
80f3449839
@ -204,18 +204,17 @@ const extraControllers = {
|
||||
|
||||
//receipt = notificationService.sendNotification(notification, await getUserIds());
|
||||
|
||||
return handleResultResponse(receipt, null, null, res, httpStatus.OK);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
return handleErrorResponse(controllerOptions.MODULE_NAME, 'sendNotification', error, res)
|
||||
} finally {
|
||||
return handleResultResponse(receipt, null, null, res, httpStatus.OK);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
updateNotificationsWithReceipts: (config) => {
|
||||
return async (req, res, next) => {
|
||||
config = config || {
|
||||
/*config = config || {
|
||||
scopes: [],
|
||||
};
|
||||
|
||||
@ -234,6 +233,7 @@ const extraControllers = {
|
||||
return Promise.all(userDeviceList.map(buildMessagePromise))
|
||||
})
|
||||
.then(sendNotificationsPromise)
|
||||
*/
|
||||
}
|
||||
},
|
||||
|
||||
@ -257,13 +257,12 @@ const extraControllers = {
|
||||
includeAll: false,
|
||||
paginate: { limit: 1, page: 1 },
|
||||
params: {
|
||||
//userId,
|
||||
token: data.token,
|
||||
}
|
||||
});
|
||||
|
||||
// Buscamos el token y el usuario
|
||||
console.log('>> Busco el usuario y el token', params.params);
|
||||
console.log('>> Busco el token', params.params);
|
||||
let result = await userDeviceService.fetchOne(params, context);
|
||||
if (!result) {
|
||||
// Dar de alta el token
|
||||
@ -276,11 +275,10 @@ const extraControllers = {
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
} finally {
|
||||
}
|
||||
// En todo caso devolver OK al cliente
|
||||
return handleResultResponse('OK', null, null, res, httpStatus.OK);
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
const routes = require('express').Router();
|
||||
|
||||
const { isAdministratorUser, isLoggedUser } = require('../../middlewares/accessValidator');
|
||||
const { isAdministratorUser, isOptionalUser, isLoggedUser } = require('../../middlewares/accessValidator');
|
||||
const SchemaValidator = require('../../middlewares/schemaValidator');
|
||||
const PaginateMiddleware = require('../../middlewares/paginate');
|
||||
const FieldMiddleware = require('../../middlewares/fields');
|
||||
@ -56,7 +56,7 @@ routes.post('/admin/notifications',
|
||||
);*/
|
||||
|
||||
routes.post('/notifications/devices',
|
||||
//isLoggedUser,
|
||||
isOptionalUser,
|
||||
SchemaValidator(deviceTokenInputType, true),
|
||||
notificationController.registerDevice()
|
||||
);
|
||||
|
||||
@ -138,8 +138,8 @@ const extraMethods = {
|
||||
|
||||
updateNotificationsWithReceipts: async (receiptIds) => {
|
||||
|
||||
let receiptIdChunks = expo.chunkPushNotificationReceiptIds(receiptIds);
|
||||
let xxx = await _getPushNotificationsResultAsync(receiptIdChunks);
|
||||
//let receiptIdChunks = expo.chunkPushNotificationReceiptIds(receiptIds);
|
||||
//let xxx = await _getPushNotificationsResultAsync(receiptIdChunks);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user