-
-
Save vinchi777/bc52a14abb33d57d7238dcba0efd9157 to your computer and use it in GitHub Desktop.
asd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
class MetrofoodProductSearch | |
include BaseService | |
include Filterable | |
attr_reader :repository, :relation, :current_user, :sort, :page, :filters | |
def initialize(current_user, sort, page, filters) | |
@repository = MetrofoodProductRepository.new | |
@relation = MetrofoodProduct | |
@current_user = current_user | |
@page = page | |
@sort = sort | |
@filters = filters || {} | |
end | |
def call | |
filter :by_user, current_user | |
filter :with_ids, filter_param(:id) | |
filter :with_metrofood_restaurant_ids, filter_param(:'metrofood_restaurant.id') | |
filter :with_statuses, filter_param(:status) | |
filter :with_created_at_between, filter_param(:'created_at:between') | |
sort | |
paginate | |
success search_result | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment