diff options
author | Rémy Coutable <remy@rymai.me> | 2018-10-22 08:52:42 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2018-10-22 08:52:42 +0000 |
commit | 631f4e2f54290b539fa3a7bc928589b1949adc34 (patch) | |
tree | b9da9af0823ab3a8ab618a61a60b1ee63f2af612 /app/finders | |
parent | 5b6007f995b60b938c65efe9a18ed4f2c7dafa4d (diff) | |
parent | 192ccaebfc09c29bc62defb5f9a0fc69600600a1 (diff) | |
download | gitlab-ce-631f4e2f54290b539fa3a7bc928589b1949adc34.tar.gz |
Merge branch '52559-applications-api-get-delete' into 'master'
Add Applications API endpoints for listing and deleting entries.
Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/52559
See merge request https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/22296
Diffstat (limited to 'app/finders')
-rw-r--r-- | app/finders/applications_finder.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/app/finders/applications_finder.rb b/app/finders/applications_finder.rb new file mode 100644 index 00000000000..3ded90f3fd5 --- /dev/null +++ b/app/finders/applications_finder.rb @@ -0,0 +1,22 @@ +# 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] + + Doorkeeper::Application.find_by(id: params[:id]) # rubocop: disable CodeReuse/ActiveRecord + end +end |