Class: LesliAudit::RequestService
- Inherits:
-
Lesli::ApplicationLesliService
- Object
- Lesli::ApplicationLesliService
- LesliAudit::RequestService
- Defined in:
- app/services/lesli_audit/request_service.rb
Instance Method Summary collapse
-
#index ⇒ Hash
Paginated list of the records.
Instance Method Details
#index ⇒ Hash
Returns Paginated list of the records.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'app/services/lesli_audit/request_service.rb', line 41 def index requests = Account::Request.all .order(created_at: :desc) .order(request_count: :desc) .page(query[:pagination][:page]) .per(query[:pagination][:perPage]) return requests search_string = nil # query[:search].downcase.gsub(" ","%") unless query[:search].blank? order_string = "user_requests.created_at" user_requests = current_user.account.users.joins(:requests) #user_requests = user_requests.where("users.email = ?", query[:filters][:user]) unless query[:filters][:user].blank? if !search_string.blank? # user_requests = user_requests.where([ # "lower(users.email) like :search_string", # "lower(request_controller) like :search_string", # "lower(request_action) like :search_string" # ].join(" or "), { # search_string: "%#{search_string}%" # }) end user_requests.select( :id, "users.id as user_id", "users.email", :request_controller, :request_action, :request_method, :user_session_id, Date2.new.date_time.("user_requests") ).page(query[:pagination][:page]) .per(query[:pagination][:perPage]) end |