2018-12-13 13:39:08 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class ApplicationsFinder
|
|
|
|
attr_reader :params
|
|
|
|
|
|
|
|
def initialize(params = {})
|
|
|
|
@params = params
|
|
|
|
end
|
|
|
|
|
|
|
|
def execute
|
|
|
|
applications = Doorkeeper::Application.where(owner_id: nil) # rubocop: disable CodeReuse/ActiveRecord
|
|
|
|
by_id(applications)
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def by_id(applications)
|
|
|
|
return applications unless params[:id]
|
|
|
|
|
2021-04-29 21:17:54 +05:30
|
|
|
applications.find_by(id: params[:id]) # rubocop: disable CodeReuse/ActiveRecord
|
2018-12-13 13:39:08 +05:30
|
|
|
end
|
|
|
|
end
|