Commit 44699461 authored by Pawel Chojnacki's avatar Pawel Chojnacki

Reduce the amount of data deployment endpoint returns

parent 27cc95ab
......@@ -9,20 +9,9 @@ class DeploymentEntity < Grape::Entity
expose :name do |deployment|
deployment.ref
end
expose :ref_path do |deployment|
namespace_project_tree_path(
deployment.project.namespace,
deployment.project,
id: deployment.ref)
end
end
expose :created_at
expose :tag
expose :last?
expose :user, using: UserEntity
expose :commit, using: CommitEntity
expose :deployable, using: BuildEntity
expose :manual_actions, using: BuildEntity
end
class DeploymentEntityDetailed < Grape::Entity
include RequestAwareEntity
expose :id
expose :iid
expose :sha
expose :ref do
expose :name do |deployment|
deployment.ref
end
expose :ref_path do |deployment|
namespace_project_tree_path(
deployment.project.namespace,
deployment.project,
id: deployment.ref)
end
end
expose :created_at
expose :tag
expose :last?
expose :user, using: UserEntity
expose :commit, using: CommitEntity
expose :deployable, using: BuildEntity
expose :manual_actions, using: BuildEntity
end
......@@ -6,7 +6,7 @@ class EnvironmentEntity < Grape::Entity
expose :state
expose :external_url
expose :environment_type
expose :last_deployment, using: DeploymentEntity
expose :last_deployment, using: DeploymentEntityDetailed
expose :stop_action?
expose :metrics_path, if: -> (environment, _) { environment.has_metrics? } do |environment|
......
require 'spec_helper'
describe DeploymentEntity do
describe DeploymentEntityDetailed do
let(:user) { create(:user) }
let(:request) { double('request') }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment