Class: WinewooCore::Repositories::Mongo::UsersMongoRepo
- Inherits:
-
Object
- Object
- WinewooCore::Repositories::Mongo::UsersMongoRepo
- Defined in:
- lib/winewoo_core/repositories/mongo/users_mongo_repo.rb
Instance Method Summary collapse
Instance Method Details
#find(filters) ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/winewoo_core/repositories/mongo/users_mongo_repo.rb', line 4 def find(filters) query = WinewooCore::Repositories::Mongo::Queries::UserQuery.new(User.unscoped) query = query.with_role(filters.user_role) if filters.user_role query = filters.scope_recents ? query.order_by(updated_at: :desc) : query.order_by(created_at: :asc) users = query.page(filters.page || 1) .per(filters.per_page || Kaminari::config.default_per_page) return users, query.count end |
#get(user_id) ⇒ Object
15 16 17 |
# File 'lib/winewoo_core/repositories/mongo/users_mongo_repo.rb', line 15 def get(user_id) return user_id && User.find(user_id) end |