Commit c562c39b authored by James Lopez's avatar James Lopez

Merge branch 'refactoring-entities-file-18' into 'master'

Add list, board, broadcast message, contributor and compare into own class files

See merge request gitlab-org/gitlab!24939
parents 4bc1239b b8498d61
---
title: Separate board, list and other entities into own class files
merge_request: 24939
author: Rajendra Kadam
type: added
......@@ -163,49 +163,6 @@ module API
end
end
class List < Grape::Entity
expose :id
expose :label, using: Entities::LabelBasic
expose :position
end
class Board < Grape::Entity
expose :id
expose :project, using: Entities::BasicProjectDetails
expose :lists, using: Entities::List do |board|
board.destroyable_lists
end
end
class Compare < Grape::Entity
expose :commit, using: Entities::Commit do |compare, _|
compare.commits.last
end
expose :commits, using: Entities::Commit do |compare, _|
compare.commits
end
expose :diffs, using: Entities::Diff do |compare, _|
compare.diffs.diffs.to_a
end
expose :compare_timeout do |compare, _|
compare.diffs.diffs.overflow?
end
expose :same, as: :compare_same_ref
end
class Contributor < Grape::Entity
expose :name, :email, :commits, :additions, :deletions
end
class BroadcastMessage < Grape::Entity
expose :message, :starts_at, :ends_at, :color, :font, :target_path, :broadcast_type
end
class Trigger < Grape::Entity
include ::API::Helpers::Presentable
......
# frozen_string_literal: true
module API
module Entities
class Board < Grape::Entity
expose :id
expose :project, using: Entities::BasicProjectDetails
expose :lists, using: Entities::List do |board|
board.destroyable_lists
end
end
end
end
......@@ -3,7 +3,7 @@
module API
module Entities
class BroadcastMessage < Grape::Entity
expose :id, :message, :starts_at, :ends_at, :color, :font
expose :id, :message, :starts_at, :ends_at, :color, :font, :target_path, :broadcast_type
expose :active?, as: :active
end
end
......
# frozen_string_literal: true
module API
module Entities
class Compare < Grape::Entity
expose :commit, using: Entities::Commit do |compare, _|
compare.commits.last
end
expose :commits, using: Entities::Commit do |compare, _|
compare.commits
end
expose :diffs, using: Entities::Diff do |compare, _|
compare.diffs.diffs.to_a
end
expose :compare_timeout do |compare, _|
compare.diffs.diffs.overflow?
end
expose :same, as: :compare_same_ref
end
end
end
# frozen_string_literal: true
module API
module Entities
class Contributor < Grape::Entity
expose :name, :email, :commits, :additions, :deletions
end
end
end
# frozen_string_literal: true
module API
module Entities
class List < Grape::Entity
expose :id
expose :label, using: Entities::LabelBasic
expose :position
end
end
end
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