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
35ac1474
Commit
35ac1474
authored
Feb 13, 2020
by
Rajendra Kadam
Committed by
Stan Hu
Feb 13, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Separate badge entities into own class files
parent
833a65e5
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
68 additions
and
43 deletions
+68
-43
changelogs/unreleased/refactoring-entities-file-30.yml
changelogs/unreleased/refactoring-entities-file-30.yml
+5
-0
lib/api/entities.rb
lib/api/entities.rb
+0
-43
lib/api/entities/badge.rb
lib/api/entities/badge.rb
+12
-0
lib/api/entities/basic_badge_details.rb
lib/api/entities/basic_badge_details.rb
+17
-0
lib/api/entities/resource_label_event.rb
lib/api/entities/resource_label_event.rb
+19
-0
lib/api/entities/suggestion.rb
lib/api/entities/suggestion.rb
+15
-0
No files found.
changelogs/unreleased/refactoring-entities-file-30.yml
0 → 100644
View file @
35ac1474
---
title
:
Separate badge entities into own class files
merge_request
:
25116
author
:
Rajendra Kadam
type
:
added
lib/api/entities.rb
View file @
35ac1474
...
...
@@ -591,49 +591,6 @@ module API
expose
:project_id
end
class
BasicBadgeDetails
<
Grape
::
Entity
expose
:name
expose
:link_url
expose
:image_url
expose
:rendered_link_url
do
|
badge
,
options
|
badge
.
rendered_link_url
(
options
.
fetch
(
:project
,
nil
))
end
expose
:rendered_image_url
do
|
badge
,
options
|
badge
.
rendered_image_url
(
options
.
fetch
(
:project
,
nil
))
end
end
class
Badge
<
BasicBadgeDetails
expose
:id
expose
:kind
do
|
badge
|
badge
.
type
==
'ProjectBadge'
?
'project'
:
'group'
end
end
class
ResourceLabelEvent
<
Grape
::
Entity
expose
:id
expose
:user
,
using:
Entities
::
UserBasic
expose
:created_at
expose
:resource_type
do
|
event
,
options
|
event
.
issuable
.
class
.
name
end
expose
:resource_id
do
|
event
,
options
|
event
.
issuable
.
id
end
expose
:label
,
using:
Entities
::
LabelBasic
expose
:action
end
class
Suggestion
<
Grape
::
Entity
expose
:id
expose
:from_line
expose
:to_line
expose
:appliable?
,
as: :appliable
expose
:applied
expose
:from_content
expose
:to_content
end
module
Platform
class
Kubernetes
<
Grape
::
Entity
expose
:api_url
...
...
lib/api/entities/badge.rb
0 → 100644
View file @
35ac1474
# frozen_string_literal: true
module
API
module
Entities
class
Badge
<
Entities
::
BasicBadgeDetails
expose
:id
expose
:kind
do
|
badge
|
badge
.
type
==
'ProjectBadge'
?
'project'
:
'group'
end
end
end
end
lib/api/entities/basic_badge_details.rb
0 → 100644
View file @
35ac1474
# frozen_string_literal: true
module
API
module
Entities
class
BasicBadgeDetails
<
Grape
::
Entity
expose
:name
expose
:link_url
expose
:image_url
expose
:rendered_link_url
do
|
badge
,
options
|
badge
.
rendered_link_url
(
options
.
fetch
(
:project
,
nil
))
end
expose
:rendered_image_url
do
|
badge
,
options
|
badge
.
rendered_image_url
(
options
.
fetch
(
:project
,
nil
))
end
end
end
end
lib/api/entities/resource_label_event.rb
0 → 100644
View file @
35ac1474
# frozen_string_literal: true
module
API
module
Entities
class
ResourceLabelEvent
<
Grape
::
Entity
expose
:id
expose
:user
,
using:
Entities
::
UserBasic
expose
:created_at
expose
:resource_type
do
|
event
,
options
|
event
.
issuable
.
class
.
name
end
expose
:resource_id
do
|
event
,
options
|
event
.
issuable
.
id
end
expose
:label
,
using:
Entities
::
LabelBasic
expose
:action
end
end
end
lib/api/entities/suggestion.rb
0 → 100644
View file @
35ac1474
# frozen_string_literal: true
module
API
module
Entities
class
Suggestion
<
Grape
::
Entity
expose
:id
expose
:from_line
expose
:to_line
expose
:appliable?
,
as: :appliable
expose
:applied
expose
:from_content
expose
:to_content
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