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
5e49d576
Commit
5e49d576
authored
Feb 12, 2020
by
Rajendra Kadam
Committed by
Stan Hu
Feb 12, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Separate job entities into own class files
parent
5e532c2c
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
64 additions
and
34 deletions
+64
-34
changelogs/unreleased/refactoring-entities-file-21.yml
changelogs/unreleased/refactoring-entities-file-21.yml
+5
-0
lib/api/entities.rb
lib/api/entities.rb
+0
-34
lib/api/entities/job.rb
lib/api/entities/job.rb
+13
-0
lib/api/entities/job_artifact.rb
lib/api/entities/job_artifact.rb
+9
-0
lib/api/entities/job_artifact_file.rb
lib/api/entities/job_artifact_file.rb
+10
-0
lib/api/entities/job_basic.rb
lib/api/entities/job_basic.rb
+18
-0
lib/api/entities/job_basic_with_project.rb
lib/api/entities/job_basic_with_project.rb
+9
-0
No files found.
changelogs/unreleased/refactoring-entities-file-21.yml
0 → 100644
View file @
5e49d576
---
title
:
Separate job entities into own class files
merge_request
:
24948
author
:
Rajendra Kadam
type
:
added
lib/api/entities.rb
View file @
5e49d576
...
...
@@ -549,40 +549,6 @@ module API
expose
:id
,
:token
end
class
JobArtifactFile
<
Grape
::
Entity
expose
:filename
expose
:cached_size
,
as: :size
end
class
JobArtifact
<
Grape
::
Entity
expose
:file_type
,
:size
,
:filename
,
:file_format
end
class
JobBasic
<
Grape
::
Entity
expose
:id
,
:status
,
:stage
,
:name
,
:ref
,
:tag
,
:coverage
,
:allow_failure
expose
:created_at
,
:started_at
,
:finished_at
expose
:duration
expose
:user
,
with:
Entities
::
User
expose
:commit
,
with:
Entities
::
Commit
expose
:pipeline
,
with:
Entities
::
PipelineBasic
expose
:web_url
do
|
job
,
_options
|
Gitlab
::
Routing
.
url_helpers
.
project_job_url
(
job
.
project
,
job
)
end
end
class
Job
<
JobBasic
# artifacts_file is included in job_artifacts, but kept for backward compatibility (remove in api/v5)
expose
:artifacts_file
,
using:
JobArtifactFile
,
if:
->
(
job
,
opts
)
{
job
.
artifacts?
}
expose
:job_artifacts
,
as: :artifacts
,
using:
JobArtifact
expose
:runner
,
with:
Runner
expose
:artifacts_expire_at
end
class
JobBasicWithProject
<
JobBasic
expose
:project
,
with:
Entities
::
ProjectIdentity
end
class
Trigger
<
Grape
::
Entity
include
::
API
::
Helpers
::
Presentable
...
...
lib/api/entities/job.rb
0 → 100644
View file @
5e49d576
# frozen_string_literal: true
module
API
module
Entities
class
Job
<
Entities
::
JobBasic
# artifacts_file is included in job_artifacts, but kept for backward compatibility (remove in api/v5)
expose
:artifacts_file
,
using:
Entities
::
JobArtifactFile
,
if:
->
(
job
,
opts
)
{
job
.
artifacts?
}
expose
:job_artifacts
,
as: :artifacts
,
using:
Entities
::
JobArtifact
expose
:runner
,
with:
Entities
::
Runner
expose
:artifacts_expire_at
end
end
end
lib/api/entities/job_artifact.rb
0 → 100644
View file @
5e49d576
# frozen_string_literal: true
module
API
module
Entities
class
JobArtifact
<
Grape
::
Entity
expose
:file_type
,
:size
,
:filename
,
:file_format
end
end
end
lib/api/entities/job_artifact_file.rb
0 → 100644
View file @
5e49d576
# frozen_string_literal: true
module
API
module
Entities
class
JobArtifactFile
<
Grape
::
Entity
expose
:filename
expose
:cached_size
,
as: :size
end
end
end
lib/api/entities/job_basic.rb
0 → 100644
View file @
5e49d576
# frozen_string_literal: true
module
API
module
Entities
class
JobBasic
<
Grape
::
Entity
expose
:id
,
:status
,
:stage
,
:name
,
:ref
,
:tag
,
:coverage
,
:allow_failure
expose
:created_at
,
:started_at
,
:finished_at
expose
:duration
expose
:user
,
with:
Entities
::
User
expose
:commit
,
with:
Entities
::
Commit
expose
:pipeline
,
with:
Entities
::
PipelineBasic
expose
:web_url
do
|
job
,
_options
|
Gitlab
::
Routing
.
url_helpers
.
project_job_url
(
job
.
project
,
job
)
end
end
end
end
lib/api/entities/job_basic_with_project.rb
0 → 100644
View file @
5e49d576
# frozen_string_literal: true
module
API
module
Entities
class
JobBasicWithProject
<
Entities
::
JobBasic
expose
:project
,
with:
Entities
::
ProjectIdentity
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