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