diff options
| author | stone <jules+okfprojz@okfoc.us> | 2017-03-28 22:56:24 -0400 |
|---|---|---|
| committer | stone <jules+okfprojz@okfoc.us> | 2017-03-28 22:56:24 -0400 |
| commit | 0bc1eeeac48314debfb2ebe9093782c888114c10 (patch) | |
| tree | 85af360be561a9c5124ab47f929d67a4437956ed /lib | |
| parent | fc21d0d79e2015d3cf297d8629b0e7c8bbcd10ae (diff) | |
| parent | ee9cea7b654dc2393cb3c37d951780012adb4d61 (diff) | |
Merge branch 'cms' of ghghgh.us:stone-island into cms
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/okpush/db.js | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/lib/okpush/db.js b/lib/okpush/db.js index 1a2099d0..09afdf34 100644 --- a/lib/okpush/db.js +++ b/lib/okpush/db.js @@ -67,28 +67,22 @@ function addToken (data) { return new PushToken(data).save() } function getAllIOSTokens (channel, cb) { - PushToken.distinct("token", { channel: channel, platform: 'ios' }, function (err, items) { + PushToken.distinct("token", { channel: channel, platform: 'ios' }, function (err, tokens) { if (err) return cb(err, []) - var items = _.map(items, function (item) { - return item.token - }) - return cb(null, items) + return cb(null, tokens) }) } function getAllAndroidTokens (channel, cb) { - PushToken.distinct("token", { channel: channel, platform: 'android' }, function (err, items) { + PushToken.distinct("token", { channel: channel, platform: 'android' }, function (err, tokens) { if (err) return cb(err, []) - var items = _.map(items, function (item) { - return item.token - }) - return cb(null, items) + return cb(null, tokens) }) } function getAllTokens (channel, cb) { - PushToken.distinct("token", { channel: channel }, function (err, items) { + PushToken.find({ channel: channel }, function (err, items) { if (err) return cb(err, []) - var items = _.map(items, function (item) { - return _.pick(item, ['platform', 'token']) + var items = items.map(function (item) { + return { platform: item.get('platform'), token: item.get('token') } }) return cb(null, items) }) |
