Modify output

This commit is contained in:
Tomasz Maczukin 2017-11-21 12:37:18 +01:00
parent b7ed102ea6
commit 7b643c02c2
No known key found for this signature in database
GPG Key ID: 7E9EB2E4B0F625CD
2 changed files with 9 additions and 6 deletions

View File

@ -832,18 +832,21 @@ module API
expose :id, :sha, :ref, :status
end
class Job < Grape::Entity
class JobBasic < Grape::Entity
expose :id, :status, :stage, :name, :ref, :tag, :coverage
expose :created_at, :started_at, :finished_at
expose :duration
expose :user, with: User
expose :artifacts_file, using: JobArtifactFile, if: -> (job, opts) { job.artifacts? }
expose :commit, with: Commit
expose :runner, with: Runner
expose :pipeline, with: PipelineBasic
end
class JobWithProject < Job
class Job < JobBasic
expose :artifacts_file, using: JobArtifactFile, if: -> (job, opts) { job.artifacts? }
expose :runner, with: Runner
end
class JobBasicWithProject < JobBasic
expose :project, with: ProjectIdentity
end

View File

@ -86,7 +86,7 @@ module API
end
desc 'List jobs running on a runner' do
success Entities::JobWithProject
success Entities::JobBasicWithProject
end
params do
requires :id, type: Integer, desc: 'The ID of the runner'
@ -103,7 +103,7 @@ module API
jobs = jobs.where(status: params[:status].to_sym)
end
present paginate(jobs), with: Entities::JobWithProject
present paginate(jobs), with: Entities::JobBasicWithProject
end
end