From b7fbbf3f91490a488e54fe5f8c700813f0ab8021 Mon Sep 17 00:00:00 2001 From: stone Date: Sat, 18 Feb 2017 22:52:02 -0500 Subject: pushing the push notifications --- lib/okpush/db.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'lib/okpush/db.js') diff --git a/lib/okpush/db.js b/lib/okpush/db.js index 563df18e..8c92753a 100644 --- a/lib/okpush/db.js +++ b/lib/okpush/db.js @@ -65,6 +65,15 @@ function errorHandler (error) { function addToken (data) { return new PushToken(data).save() } +function getAllIOSTokens (channel, cb) { + PushToken.find({ channel: channel, platform: 'ios' }, function (err, items) { + if (err) return cb(err, null) + var items = _.map(items, function (item) { + return item.token + }) + return cb(null, items) + }) +} function getAllTokens (channel, cb) { PushToken.find({ channel: channel }, function (err, items) { if (err) return cb(err, null) @@ -134,7 +143,8 @@ module.exports = { addToken: addToken, removeToken: removeToken, getAllTokens: getAllTokens, + getAllIOSTokens: getAllIOSTokens, getDeviceCount: getDeviceCount, addNotification: addNotification, getNotifications: getNotifications, -} \ No newline at end of file +} -- cgit v1.2.3-70-g09d2