summaryrefslogtreecommitdiff
path: root/examples/lib/okpush/db.js
diff options
context:
space:
mode:
Diffstat (limited to 'examples/lib/okpush/db.js')
-rw-r--r--examples/lib/okpush/db.js16
1 files changed, 8 insertions, 8 deletions
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