Class: WinewooCore::Repositories::Mongo::FavoritesMongoRepo

Inherits:
Object
  • Object
show all
Defined in:
lib/winewoo_core/repositories/mongo/favorites_mongo_repo.rb

Instance Method Summary collapse

Instance Method Details

#create(winewoo_user, favorite_params) ⇒ Object



14
15
16
# File 'lib/winewoo_core/repositories/mongo/favorites_mongo_repo.rb', line 14

def create(winewoo_user, favorite_params)
  winewoo_user.favorites.create(favorite_params)
end

#destroy(winewoo_user, favorite_id) ⇒ Object



19
20
21
22
23
# File 'lib/winewoo_core/repositories/mongo/favorites_mongo_repo.rb', line 19

def destroy(winewoo_user, favorite_id)
  favorite = winewoo_user.favorites.find(favorite_id)
  favorite.destroy if favorite
  return favorite
end

#find(winewoo_user, filters) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/winewoo_core/repositories/mongo/favorites_mongo_repo.rb', line 4

def find(winewoo_user, filters)
  # TODO UNOFFICIALS
  # winewoo_user.favorites.map do |entry|
  #   wine = Wine.find entry.wine_id
  #   entry if wine && wine.official?
  # end.reject(&:blank?)
  winewoo_user.favorites
end