diff --git a/lib/storage.js b/lib/storage.js index 73e4941..983737f 100644 --- a/lib/storage.js +++ b/lib/storage.js @@ -277,44 +277,6 @@ Storage.prototype.fetchTxs = function(walletId, opts, cb) { }; -/** - * fetchNotifications - * - * @param walletId - * @param opts.minTs - * @param opts.maxTs - * @param opts.limit - * @param opts.reverse - */ -Storage.prototype.fetchNotifications = function(walletId, opts, cb) { - var self = this; - - opts = opts || {}; - - var tsFilter = {}; - if (_.isNumber(opts.minTs)) tsFilter.$gte = opts.minTs; - if (_.isNumber(opts.maxTs)) tsFilter.$lte = opts.maxTs; - - var filter = { - walletId: walletId - }; - if (!_.isEmpty(tsFilter)) filter.createdOn = tsFilter; - - var mods = {}; - if (_.isNumber(opts.limit)) mods.limit = opts.limit; - - this.db.collection(collections.NOTIFICATIONS).find(filter, mods).sort({ - id: opts.reverse ? -1 : 1, - }).toArray(function(err, result) { - if (err) return cb(err); - if (!result) return cb(); - var notifications = _.map(result, function(notification) { - return Model.Notification.fromObj(notification); - }); - return cb(null, notifications); - }); -}; - /** * Retrieves notifications after a specific id or from a given ts (whichever is more recent). *