Commit 89e14fb6 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Merge branch 'refactoring-ee-entities-3' into 'master'

Separate ee entities into own class files

See merge request gitlab-org/gitlab!25709
parents 2915c8be a2da4535
---
title: Separate ee entities into own class file
merge_request: 25709
author: Rajendra Kadam
type: added
...@@ -265,42 +265,6 @@ module EE ...@@ -265,42 +265,6 @@ module EE
end end
end end
class EpicIssueLink < Grape::Entity
expose :id
expose :relative_position
expose :epic do |epic_issue_link, _options|
::EE::API::Entities::Epic.represent(epic_issue_link.epic, with_reference: true)
end
expose :issue, using: ::API::Entities::IssueBasic
end
class IssueLink < Grape::Entity
expose :source, as: :source_issue, using: ::API::Entities::IssueBasic
expose :target, as: :target_issue, using: ::API::Entities::IssueBasic
expose :link_type
end
class SpecialBoardFilter < Grape::Entity
expose :title
end
class ApprovalRuleShort < Grape::Entity
expose :id, :name, :rule_type
end
class ApprovalRule < ApprovalRuleShort
def initialize(object, options = {})
presenter = ::ApprovalRulePresenter.new(object, current_user: options[:current_user])
super(presenter, options)
end
expose :approvers, as: :eligible_approvers, using: ::API::Entities::UserBasic
expose :approvals_required
expose :users, using: ::API::Entities::UserBasic
expose :groups, using: ::API::Entities::Group
expose :contains_hidden_groups?, as: :contains_hidden_groups
end
class ProjectApprovalRule < ApprovalRule class ProjectApprovalRule < ApprovalRule
expose :protected_branches, using: ::API::Entities::ProtectedBranch, if: -> (rule, _) { rule.project.multiple_approval_rules_available? } expose :protected_branches, using: ::API::Entities::ProtectedBranch, if: -> (rule, _) { rule.project.multiple_approval_rules_available? }
end end
......
# frozen_string_literal: true
module EE
module API
module Entities
class ApprovalRule < ApprovalRuleShort
def initialize(object, options = {})
presenter = ::ApprovalRulePresenter.new(object, current_user: options[:current_user])
super(presenter, options)
end
expose :approvers, as: :eligible_approvers, using: ::API::Entities::UserBasic
expose :approvals_required
expose :users, using: ::API::Entities::UserBasic
expose :groups, using: ::API::Entities::Group
expose :contains_hidden_groups?, as: :contains_hidden_groups
end
end
end
end
# frozen_string_literal: true
module EE
module API
module Entities
class ApprovalRuleShort < Grape::Entity
expose :id, :name, :rule_type
end
end
end
end
# frozen_string_literal: true
module EE
module API
module Entities
class EpicIssueLink < Grape::Entity
expose :id
expose :relative_position
expose :epic do |epic_issue_link, _options|
::EE::API::Entities::Epic.represent(epic_issue_link.epic, with_reference: true)
end
expose :issue, using: ::API::Entities::IssueBasic
end
end
end
end
# frozen_string_literal: true
module EE
module API
module Entities
class IssueLink < Grape::Entity
expose :source, as: :source_issue, using: ::API::Entities::IssueBasic
expose :target, as: :target_issue, using: ::API::Entities::IssueBasic
expose :link_type
end
end
end
end
# frozen_string_literal: true
module EE
module API
module Entities
class SpecialBoardFilter < Grape::Entity
expose :title
end
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