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
b4e16cda
Commit
b4e16cda
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 environment entities in class files
parent
b9940c46
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
63 additions
and
33 deletions
+63
-33
changelogs/unreleased/refactoring-entities-file-23.yml
changelogs/unreleased/refactoring-entities-file-23.yml
+5
-0
lib/api/entities.rb
lib/api/entities.rb
+0
-33
lib/api/entities/deployment.rb
lib/api/entities/deployment.rb
+13
-0
lib/api/entities/environment.rb
lib/api/entities/environment.rb
+11
-0
lib/api/entities/environment_basic.rb
lib/api/entities/environment_basic.rb
+9
-0
lib/api/entities/license.rb
lib/api/entities/license.rb
+14
-0
lib/api/entities/license_basic.rb
lib/api/entities/license_basic.rb
+11
-0
No files found.
changelogs/unreleased/refactoring-entities-file-23.yml
0 → 100644
View file @
b4e16cda
---
title
:
Separate environment entities into own class files
merge_request
:
24951
author
:
Rajendra Kadam
type
:
added
lib/api/entities.rb
View file @
b4e16cda
...
...
@@ -358,39 +358,6 @@ module API
expose
:variables
,
using:
Entities
::
Variable
end
class
EnvironmentBasic
<
Grape
::
Entity
expose
:id
,
:name
,
:slug
,
:external_url
end
class
Deployment
<
Grape
::
Entity
expose
:id
,
:iid
,
:ref
,
:sha
,
:created_at
,
:updated_at
expose
:user
,
using:
Entities
::
UserBasic
expose
:environment
,
using:
Entities
::
EnvironmentBasic
expose
:deployable
,
using:
Entities
::
Job
expose
:status
end
class
Environment
<
EnvironmentBasic
expose
:project
,
using:
Entities
::
BasicProjectDetails
expose
:last_deployment
,
using:
Entities
::
Deployment
,
if:
{
last_deployment:
true
}
expose
:state
end
class
LicenseBasic
<
Grape
::
Entity
expose
:key
,
:name
,
:nickname
expose
:url
,
as: :html_url
expose
(
:source_url
)
{
|
license
|
license
.
meta
[
'source'
]
}
end
class
License
<
LicenseBasic
expose
:popular?
,
as: :popular
expose
(
:description
)
{
|
license
|
license
.
meta
[
'description'
]
}
expose
(
:conditions
)
{
|
license
|
license
.
meta
[
'conditions'
]
}
expose
(
:permissions
)
{
|
license
|
license
.
meta
[
'permissions'
]
}
expose
(
:limitations
)
{
|
license
|
license
.
meta
[
'limitations'
]
}
expose
:content
end
class
ImpersonationToken
<
PersonalAccessToken
expose
:impersonation
end
...
...
lib/api/entities/deployment.rb
0 → 100644
View file @
b4e16cda
# frozen_string_literal: true
module
API
module
Entities
class
Deployment
<
Grape
::
Entity
expose
:id
,
:iid
,
:ref
,
:sha
,
:created_at
,
:updated_at
expose
:user
,
using:
Entities
::
UserBasic
expose
:environment
,
using:
Entities
::
EnvironmentBasic
expose
:deployable
,
using:
Entities
::
Job
expose
:status
end
end
end
lib/api/entities/environment.rb
0 → 100644
View file @
b4e16cda
# frozen_string_literal: true
module
API
module
Entities
class
Environment
<
Entities
::
EnvironmentBasic
expose
:project
,
using:
Entities
::
BasicProjectDetails
expose
:last_deployment
,
using:
Entities
::
Deployment
,
if:
{
last_deployment:
true
}
expose
:state
end
end
end
lib/api/entities/environment_basic.rb
0 → 100644
View file @
b4e16cda
# frozen_string_literal: true
module
API
module
Entities
class
EnvironmentBasic
<
Grape
::
Entity
expose
:id
,
:name
,
:slug
,
:external_url
end
end
end
lib/api/entities/license.rb
0 → 100644
View file @
b4e16cda
# frozen_string_literal: true
module
API
module
Entities
class
License
<
Entities
::
LicenseBasic
expose
:popular?
,
as: :popular
expose
(
:description
)
{
|
license
|
license
.
meta
[
'description'
]
}
expose
(
:conditions
)
{
|
license
|
license
.
meta
[
'conditions'
]
}
expose
(
:permissions
)
{
|
license
|
license
.
meta
[
'permissions'
]
}
expose
(
:limitations
)
{
|
license
|
license
.
meta
[
'limitations'
]
}
expose
:content
end
end
end
lib/api/entities/license_basic.rb
0 → 100644
View file @
b4e16cda
# frozen_string_literal: true
module
API
module
Entities
class
LicenseBasic
<
Grape
::
Entity
expose
:key
,
:name
,
:nickname
expose
:url
,
as: :html_url
expose
(
:source_url
)
{
|
license
|
license
.
meta
[
'source'
]
}
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