Skip to content

Commit 7b643c0

Browse files
committed
Modify output
1 parent b7ed102 commit 7b643c0

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

lib/api/entities.rb

+7-4
Original file line numberDiff line numberDiff line change
@@ -832,18 +832,21 @@ class PipelineBasic < Grape::Entity
832832
expose :id, :sha, :ref, :status
833833
end
834834

835-
class Job < Grape::Entity
835+
class JobBasic < Grape::Entity
836836
expose :id, :status, :stage, :name, :ref, :tag, :coverage
837837
expose :created_at, :started_at, :finished_at
838838
expose :duration
839839
expose :user, with: User
840-
expose :artifacts_file, using: JobArtifactFile, if: -> (job, opts) { job.artifacts? }
841840
expose :commit, with: Commit
842-
expose :runner, with: Runner
843841
expose :pipeline, with: PipelineBasic
844842
end
845843

846-
class JobWithProject < Job
844+
class Job < JobBasic
845+
expose :artifacts_file, using: JobArtifactFile, if: -> (job, opts) { job.artifacts? }
846+
expose :runner, with: Runner
847+
end
848+
849+
class JobBasicWithProject < JobBasic
847850
expose :project, with: ProjectIdentity
848851
end
849852

lib/api/runners.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class Runners < Grape::API
8686
end
8787

8888
desc 'List jobs running on a runner' do
89-
success Entities::JobWithProject
89+
success Entities::JobBasicWithProject
9090
end
9191
params do
9292
requires :id, type: Integer, desc: 'The ID of the runner'
@@ -103,7 +103,7 @@ class Runners < Grape::API
103103
jobs = jobs.where(status: params[:status].to_sym)
104104
end
105105

106-
present paginate(jobs), with: Entities::JobWithProject
106+
present paginate(jobs), with: Entities::JobBasicWithProject
107107
end
108108
end
109109

0 commit comments

Comments
 (0)