summaryrefslogtreecommitdiff
path: root/lib/okpush/db.js
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2017-02-19 04:53:51 +0100
committerJules Laplace <jules@okfoc.us>2017-02-19 04:53:51 +0100
commit74468b9867aff92417afe0598a2146b3726d4393 (patch)
treea9c5f59aab68be3dbc2d95591293c4d1d092fb19 /lib/okpush/db.js
parent6e5e218831aa5be1c647ceae2693c2ece31b8b41 (diff)
parentb7fbbf3f91490a488e54fe5f8c700813f0ab8021 (diff)
Merge branch 'cms' of ghghgh.us:stone-island into cms
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 598800f3..35a4c86e 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)
@@ -135,7 +144,8 @@ module.exports = {
addToken: addToken,
removeToken: removeToken,
getAllTokens: getAllTokens,
+ getAllIOSTokens: getAllIOSTokens,
getDeviceCount: getDeviceCount,
addNotification: addNotification,
getNotifications: getNotifications,
-} \ No newline at end of file
+}