Added web and email notifications. Tests. Fire page
This commit is contained in:
parent
df05b33e82
commit
3bf21c8caf
32 changed files with 696 additions and 88 deletions
25
imports/api/Notifications/methods.js
Normal file
25
imports/api/Notifications/methods.js
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import Notifications from './Notifications';
|
||||
import rateLimit from '../../modules/rate-limit';
|
||||
|
||||
Meteor.methods({
|
||||
'notifications.sent': function notificationsUpdate(notifId) {
|
||||
check(notifId, Meteor.Collection.ObjectID);
|
||||
|
||||
try {
|
||||
Notifications.update(notifId, { $set: { webNotified: true, webNotifiedAt: new Date() } });
|
||||
return notifId;
|
||||
} catch (exception) {
|
||||
throw new Meteor.Error('500', exception);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
rateLimit({
|
||||
methods: [
|
||||
'notifications.sent'
|
||||
],
|
||||
limit: 5,
|
||||
timeRange: 1000
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue