53 lines
1.3 KiB
JavaScript
Raw Normal View History

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
schedule.permit(['insert', 'update', 'remove']).never().apply();
// schedule.remove({});
SyncedCron.add({
name: 'Remove Entries past today',
schedule: function(parser) {
return parser.recur().on('07:46:00').time();
},
job: function() {
var today = moment().format("X");
// 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 === "")) {
mymoment = moment(pre.replace("/", "-"), "MM-DD-YYYY");
2016-02-10 11:58:21 -05:00
thepretext = mymoment.toISOString().split("T")[0];
time = mymoment.format("X");
previous = schedule.find({"pretext": thepretext}).fetch();
if (previous.length > 0) {
entry = previous[0]
schedule.update(entry._id, {"aftertext": post, "pretext": entry.pretext, "timestamp": entry.timestamp});
} else {
schedule.insert({
"pretext": thepretext,
2016-02-08 21:25:30 -05:00
"aftertext": post,
2016-02-10 11:58:21 -05:00
"timestamp": time
});
}
2016-02-06 15:21:25 -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
})