2016-02-06 15:21:25 -05:00
|
|
|
var allowed = {};
|
|
|
|
|
allowed["ybq987@gmail.com"] = true;
|
|
|
|
|
allowed["dweinger@bloomfield.org"] = true;
|
2016-02-08 16:57:50 -05:00
|
|
|
allowed["ksjdragon@gmail.com"] = true;
|
2016-02-06 15:21:25 -05:00
|
|
|
|
2016-02-07 01:46:01 -05:00
|
|
|
schedule.permit(['insert', 'update', 'remove']).never().apply();
|
|
|
|
|
|
2016-02-08 20:53:43 -05:00
|
|
|
// schedule.remove({});
|
|
|
|
|
|
2016-02-07 01:46:01 -05:00
|
|
|
SyncedCron.add({
|
|
|
|
|
name: 'Remove Entries past today',
|
|
|
|
|
schedule: function(parser) {
|
2016-02-10 07:53:15 -05:00
|
|
|
return parser.recur().on('07:46:00').time();
|
2016-02-07 01:46:01 -05:00
|
|
|
},
|
|
|
|
|
job: function() {
|
2016-02-10 07:53:15 -05:00
|
|
|
var today = moment().format("X");
|
2016-02-07 01:46:01 -05:00
|
|
|
|
|
|
|
|
// Remove matchng Documents
|
|
|
|
|
schedule.remove({timestamp: {$lt: today}});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
SyncedCron.start();
|
|
|
|
|
|
2016-02-06 15:21:25 -05:00
|
|
|
|
|
|
|
|
Meteor.methods({
|
|
|
|
|
|
|
|
|
|
add_button: function(chrome, pre, post) {
|
2016-02-08 21:25:30 -05:00
|
|
|
if ((Meteor.user() != undefined) && (Meteor.user().services.google.email in allowed) && !(pre === "")) {
|
2016-02-10 07:53:15 -05:00
|
|
|
mymoment = moment(pre.replace("/", "-"), "MM-DD-YYYY");
|
2016-02-08 21:25:30 -05:00
|
|
|
schedule.insert({
|
2016-02-10 07:53:15 -05:00
|
|
|
"pretext": mymoment.toISOString().split("T")[0],
|
2016-02-08 21:25:30 -05:00
|
|
|
"aftertext": post,
|
2016-02-10 07:53:15 -05:00
|
|
|
"timestamp": mymoment.format("X")
|
2016-02-08 21:25:30 -05:00
|
|
|
});
|
2016-02-06 15:21:25 -05:00
|
|
|
}
|
2016-02-08 20:53:43 -05:00
|
|
|
},
|
|
|
|
|
remove: function(chrome) {
|
|
|
|
|
if (Meteor.user() != undefined && Meteor.user().services.google.email in allowed) {
|
|
|
|
|
schedule.remove(chrome._id);
|
|
|
|
|
}
|
2016-02-06 15:21:25 -05:00
|
|
|
}
|
2016-02-07 15:20:03 -05:00
|
|
|
})
|