Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
1ae9aefe
Commit
1ae9aefe
authored
Oct 15, 2018
by
JB Vasseur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use application finder for Doorkeeper Applications
parent
c47aea75
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
6 deletions
+29
-6
app/finders/applications_finder.rb
app/finders/applications_finder.rb
+26
-0
lib/api/applications.rb
lib/api/applications.rb
+3
-6
No files found.
app/finders/applications_finder.rb
0 → 100644
View file @
1ae9aefe
# frozen_string_literal: true
class
ApplicationsFinder
attr_reader
:params
def
initialize
(
params
=
{})
@params
=
params
end
# rubocop: disable CodeReuse/ActiveRecord
def
execute
applications
=
Doorkeeper
::
Application
.
where
(
"owner_id IS NULL"
)
by_id
(
applications
)
end
# rubocop: enable CodeReuse/ActiveRecord
private
# rubocop: disable CodeReuse/ActiveRecord
def
by_id
(
applications
)
return
applications
unless
params
[
:id
]
Doorkeeper
::
Application
.
find_by
(
id:
params
[
:id
])
end
# rubocop: enable CodeReuse/ActiveRecord
end
lib/api/applications.rb
View file @
1ae9aefe
...
...
@@ -25,24 +25,21 @@ module API
end
end
# rubocop: disable CodeReuse/ActiveRecord
desc
'Get applications'
do
success
Entities
::
Application
end
get
do
applications
=
Doorkeeper
::
Application
.
where
(
"owner_id IS NULL"
)
applications
=
ApplicationsFinder
.
new
.
execute
present
applications
,
with:
Entities
::
Application
end
# rubocop: enable CodeReuse/ActiveRecord
# rubocop: disable CodeReuse/ActiveRecord
desc
'Delete an application'
delete
':id'
do
Doorkeeper
::
Application
.
find_by
(
id:
params
[
:id
]).
destroy
application
=
ApplicationsFinder
.
new
(
params
).
execute
application
.
destroy
status
204
end
# rubocop: enable CodeReuse/ActiveRecord
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment