2019-10-03 19:37:56 +00:00
|
|
|
const routes = require('express').Router();
|
|
|
|
|
|
|
|
|
|
const { isAdministratorUser, isLoggedUser } = require('../../middlewares/accessValidator');
|
|
|
|
|
const SchemaValidator = require('../../middlewares/schemaValidator');
|
|
|
|
|
|
|
|
|
|
const FieldMiddleware = require('../../middlewares/fields');
|
|
|
|
|
const pushTokenController = require('./push.controller');
|
2019-10-14 15:25:35 +00:00
|
|
|
const { pushInputType, pushSendType } = require('./push.validations');
|
2019-10-03 19:37:56 +00:00
|
|
|
|
|
|
|
|
const generalInvalidFields = [
|
|
|
|
|
'createdAt', 'updatedAt',
|
|
|
|
|
];
|
|
|
|
|
|
2019-10-14 15:25:35 +00:00
|
|
|
routes.post('/notifications/send/',
|
|
|
|
|
isAdministratorUser,
|
|
|
|
|
SchemaValidator(pushSendType, true),
|
|
|
|
|
pushTokenController.sendNotification()
|
2019-10-03 19:37:56 +00:00
|
|
|
);
|
|
|
|
|
|
2019-10-14 15:25:35 +00:00
|
|
|
routes.post('/notifications/register',
|
2019-10-03 19:37:56 +00:00
|
|
|
isLoggedUser,
|
|
|
|
|
SchemaValidator(pushInputType, true),
|
2019-10-14 15:25:35 +00:00
|
|
|
pushTokenController.registerUser()
|
2019-10-03 19:37:56 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
module.exports = routes;
|