diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-03-30 23:43:55 +0100 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-04-02 10:38:00 +0200 |
commit | 635a9d779549832b4dacb2c5b9f4033d846bf154 (patch) | |
tree | b473bad6fb12533ffc3165b01b883a6be9c98235 /js/app/services/bl/feedbl.coffee | |
parent | f1afe719bbe162d8737f1e5d65a4cff99979e5ff (diff) |
split logic into business layers
Diffstat (limited to 'js/app/services/bl/feedbl.coffee')
-rw-r--r-- | js/app/services/bl/feedbl.coffee | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/js/app/services/bl/feedbl.coffee b/js/app/services/bl/feedbl.coffee new file mode 100644 index 000000000..1c2e4af09 --- /dev/null +++ b/js/app/services/bl/feedbl.coffee @@ -0,0 +1,65 @@ +### + +ownCloud - News + +@author Bernhard Posselt +@copyright 2012 Bernhard Posselt nukeawhale@gmail.com + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +License as published by the Free Software Foundation; either +version 3 of the License, or any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU AFFERO GENERAL PUBLIC LICENSE for more details. + +You should have received a copy of the GNU Affero General Public +License along with this library. If not, see <http://www.gnu.org/licenses/>. + +### + + +angular.module('News').factory '_FeedBl', -> + + class FeedBl + + constructor: (@_feedModel, @_itemBl, @_persistence) -> + + + getUnreadCount: (feedId) -> + @_feedModel.getFeedUnreadCount(feedId) + + + getFeedsOfFolder: (folderId) -> + return @_feedModel.getAllOfFolder(folderId) + + + getFolderUnreadCount: (folderId) -> + @_feedModel.getFolderUnreadCount(folderId) + + + getUnreadCount: -> + return @_feedModel.getUnreadCount() + + + delete: (feedId) -> + @_feedModel.removeById(feedId) + @_persistence.deleteFeed(feedId) + + + markFeedRead: (feedId) -> + feed = @_feedModel.getById(feedId) + if angular.isDefined(feed) + feed.unreadCount = 0 + @_itemBl.markAllRead(feedId) + + + markAllRead: -> + for feed in @_feedModel.getAll() + @markFeedRead(feed.id) + + + + return FeedBl |