From c8c0b465d9796b526d268ea0e641fd7ba00e44bb Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 6 Oct 2016 14:46:54 -0400 Subject: displaying list of notifications, slight css tweaks --- examples/lib/okpush/db.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'examples/lib/okpush/db.js') diff --git a/examples/lib/okpush/db.js b/examples/lib/okpush/db.js index 7727825..75beb65 100644 --- a/examples/lib/okpush/db.js +++ b/examples/lib/okpush/db.js @@ -26,7 +26,7 @@ function init (config) { required: true, lowercase: true, }, - last_fired: { + last_push: { type: 'Date', required: true, } @@ -65,21 +65,21 @@ function removeDevices (tokens) { function updateNotification (key, cb) { var now = new Date - Notification.findOrCreate({key: key}, {last_fired: now}, function(err, note, created){ + Notification.findOrCreate({key: key}, {last_push: now}, function(err, note, created){ if (err) { console.error("Error finding/creating notification", err) cb(err, false) return } else if (! created) { - note.last_fired = now + note.last_push = now note.save() cb(null, note) } cb(null, note) }) } -function getAllNotifications (cb) { +function getNotifications (cb) { Notification.find( wrapNotificationCallback(cb) ) } @@ -93,7 +93,7 @@ function wrapDeviceCallback (cb) { return _.pick(item, ['type', 'token']) }) - return callback(null, items) + return cb(null, items) } } function wrapNotificationCallback (cb) { @@ -101,10 +101,10 @@ function wrapNotificationCallback (cb) { if (err) return cb(err, null) var items = _.map(items, function (item) { - return _.pick(item, ['key', 'last_fired']) + return _.pick(item, ['key', 'last_push']) }) - return callback(null, items) + return cb(null, items) } } module.exports = { @@ -114,5 +114,5 @@ module.exports = { removeDevice: removeDevice, removeDevices: removeDevices, updateNotification: updateNotification, - getAllNotifications: getAllNotifications, + getNotifications: getNotifications, } \ No newline at end of file -- cgit v1.2.3-70-g09d2