2018-10-15 10:03:08 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class ApplicationsFinder
|
|
|
|
attr_reader :params
|
|
|
|
|
|
|
|
def initialize(params = {})
|
|
|
|
@params = params
|
|
|
|
end
|
|
|
|
|
|
|
|
def execute
|
2018-10-18 19:28:44 -04:00
|
|
|
applications = Doorkeeper::Application.where(owner_id: nil) # rubocop: disable CodeReuse/ActiveRecord
|
2018-10-15 10:03:08 -04:00
|
|
|
by_id(applications)
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def by_id(applications)
|
|
|
|
return applications unless params[:id]
|
|
|
|
|
2021-03-16 14:11:53 -04:00
|
|
|
applications.find_by(id: params[:id]) # rubocop: disable CodeReuse/ActiveRecord
|
2018-10-15 10:03:08 -04:00
|
|
|
end
|
|
|
|
end
|