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
cd0da6a4
Commit
cd0da6a4
authored
Feb 12, 2020
by
Rajendra Kadam
Committed by
Stan Hu
Feb 12, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add token, template entities into own class files
parent
5e532c2c
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
56 additions
and
26 deletions
+56
-26
changelogs/unreleased/refactoring-entities-file-24.yml
changelogs/unreleased/refactoring-entities-file-24.yml
+5
-0
lib/api/entities.rb
lib/api/entities.rb
+0
-26
lib/api/entities/broadcast_message.rb
lib/api/entities/broadcast_message.rb
+10
-0
lib/api/entities/personal_access_token.rb
lib/api/entities/personal_access_token.rb
+13
-0
lib/api/entities/personal_access_token_with_token.rb
lib/api/entities/personal_access_token_with_token.rb
+9
-0
lib/api/entities/template.rb
lib/api/entities/template.rb
+9
-0
lib/api/entities/templates_list.rb
lib/api/entities/templates_list.rb
+10
-0
No files found.
changelogs/unreleased/refactoring-entities-file-24.yml
0 → 100644
View file @
cd0da6a4
---
title
:
Separate token and template entities into own class files
merge_request
:
24955
author
:
Rajendra Kadam
type
:
added
lib/api/entities.rb
View file @
cd0da6a4
...
...
@@ -657,32 +657,6 @@ module API
expose
:content
end
class
TemplatesList
<
Grape
::
Entity
expose
:key
expose
:name
end
class
Template
<
Grape
::
Entity
expose
:name
,
:content
end
class
BroadcastMessage
<
Grape
::
Entity
expose
:id
,
:message
,
:starts_at
,
:ends_at
,
:color
,
:font
expose
:active?
,
as: :active
end
class
PersonalAccessToken
<
Grape
::
Entity
expose
:id
,
:name
,
:revoked
,
:created_at
,
:scopes
expose
:active?
,
as: :active
expose
:expires_at
do
|
personal_access_token
|
personal_access_token
.
expires_at
?
personal_access_token
.
expires_at
.
strftime
(
"%Y-%m-%d"
)
:
nil
end
end
class
PersonalAccessTokenWithToken
<
PersonalAccessToken
expose
:token
end
class
ImpersonationToken
<
PersonalAccessToken
expose
:impersonation
end
...
...
lib/api/entities/broadcast_message.rb
0 → 100644
View file @
cd0da6a4
# frozen_string_literal: true
module
API
module
Entities
class
BroadcastMessage
<
Grape
::
Entity
expose
:id
,
:message
,
:starts_at
,
:ends_at
,
:color
,
:font
expose
:active?
,
as: :active
end
end
end
lib/api/entities/personal_access_token.rb
0 → 100644
View file @
cd0da6a4
# frozen_string_literal: true
module
API
module
Entities
class
PersonalAccessToken
<
Grape
::
Entity
expose
:id
,
:name
,
:revoked
,
:created_at
,
:scopes
expose
:active?
,
as: :active
expose
:expires_at
do
|
personal_access_token
|
personal_access_token
.
expires_at
?
personal_access_token
.
expires_at
.
strftime
(
"%Y-%m-%d"
)
:
nil
end
end
end
end
lib/api/entities/personal_access_token_with_token.rb
0 → 100644
View file @
cd0da6a4
# frozen_string_literal: true
module
API
module
Entities
class
PersonalAccessTokenWithToken
<
Entities
::
PersonalAccessToken
expose
:token
end
end
end
lib/api/entities/template.rb
0 → 100644
View file @
cd0da6a4
# frozen_string_literal: true
module
API
module
Entities
class
Template
<
Grape
::
Entity
expose
:name
,
:content
end
end
end
lib/api/entities/templates_list.rb
0 → 100644
View file @
cd0da6a4
# frozen_string_literal: true
module
API
module
Entities
class
TemplatesList
<
Grape
::
Entity
expose
:key
expose
:name
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