Commit 778da3ce authored by Rajendra Kadam's avatar Rajendra Kadam

Separate merge request approval rules in own class files

parent 08ef4da5
......@@ -262,32 +262,6 @@ module EE
end
end
class ProjectApprovalRule < ApprovalRule
expose :protected_branches, using: ::API::Entities::ProtectedBranch, if: -> (rule, _) { rule.project.multiple_approval_rules_available? }
end
class MergeRequestApprovalRule < ApprovalRule
class SourceRule < Grape::Entity
expose :approvals_required
end
expose :source_rule, using: SourceRule
end
class MergeRequestApprovalStateRule < MergeRequestApprovalRule
expose :code_owner
expose :approved_approvers, as: :approved_by, using: ::API::Entities::UserBasic
expose :approved?, as: :approved
end
class MergeRequestApprovalState < Grape::Entity
expose :approval_rules_overwritten do |approval_state|
approval_state.approval_rules_overwritten?
end
expose :wrapped_approval_rules, as: :rules, using: MergeRequestApprovalStateRule
end
# Being used in private project-level approvals API.
# This overrides the `eligible_approvers` to be exposed as `approvers`.
#
......
# frozen_string_literal: true
module EE
module API
module Entities
class MergeRequestApprovalRule < ApprovalRule
expose :source_rule, using: MergeRequestApprovalRule::SourceRule
end
end
end
end
# frozen_string_literal: true
module EE
module API
module Entities
class MergeRequestApprovalRule < ApprovalRule
class SourceRule < Grape::Entity
expose :approvals_required
end
end
end
end
end
# frozen_string_literal: true
module EE
module API
module Entities
class MergeRequestApprovalState < Grape::Entity
expose :approval_rules_overwritten do |approval_state|
approval_state.approval_rules_overwritten?
end
expose :wrapped_approval_rules, as: :rules, using: MergeRequestApprovalStateRule
end
end
end
end
# frozen_string_literal: true
module EE
module API
module Entities
class MergeRequestApprovalStateRule < MergeRequestApprovalRule
expose :code_owner
expose :approved_approvers, as: :approved_by, using: ::API::Entities::UserBasic
expose :approved?, as: :approved
end
end
end
end
# frozen_string_literal: true
module EE
module API
module Entities
class ProjectApprovalRule < ApprovalRule
expose :protected_branches, using: ::API::Entities::ProtectedBranch, if: -> (rule, _) { rule.project.multiple_approval_rules_available? }
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