2018-12-05 23:21:45 +05:30
# frozen_string_literal: true
2018-11-08 19:23:39 +05:30
module Types
class MergeRequestType < BaseObject
2019-07-07 11:18:12 +05:30
graphql_name 'MergeRequest'
2019-09-04 21:01:54 +05:30
implements ( Types :: Notes :: NoteableType )
2019-07-07 11:18:12 +05:30
authorize :read_merge_request
2018-11-08 19:23:39 +05:30
expose_permissions Types :: PermissionTypes :: MergeRequest
present_using MergeRequestPresenter
field :id , GraphQL :: ID_TYPE , null : false
2019-09-04 21:01:54 +05:30
field :iid , GraphQL :: STRING_TYPE , null : false
2018-11-08 19:23:39 +05:30
field :title , GraphQL :: STRING_TYPE , null : false
2019-09-30 21:07:59 +05:30
markdown_field :title_html , null : true
2018-11-08 19:23:39 +05:30
field :description , GraphQL :: STRING_TYPE , null : true
2019-09-30 21:07:59 +05:30
markdown_field :description_html , null : true
2019-07-07 11:18:12 +05:30
field :state , MergeRequestStateEnum , null : false
2018-11-08 19:23:39 +05:30
field :created_at , Types :: TimeType , null : false
field :updated_at , Types :: TimeType , null : false
field :source_project , Types :: ProjectType , null : true
field :target_project , Types :: ProjectType , null : false
2019-09-30 21:07:59 +05:30
field :diff_refs , Types :: DiffRefsType , null : true
2018-11-08 19:23:39 +05:30
# Alias for target_project
field :project , Types :: ProjectType , null : false
field :project_id , GraphQL :: INT_TYPE , null : false , method : :target_project_id
field :source_project_id , GraphQL :: INT_TYPE , null : true
field :target_project_id , GraphQL :: INT_TYPE , null : false
field :source_branch , GraphQL :: STRING_TYPE , null : false
field :target_branch , GraphQL :: STRING_TYPE , null : false
field :work_in_progress , GraphQL :: BOOLEAN_TYPE , method : :work_in_progress? , null : false
field :merge_when_pipeline_succeeds , GraphQL :: BOOLEAN_TYPE , null : true
field :diff_head_sha , GraphQL :: STRING_TYPE , null : true
field :merge_commit_sha , GraphQL :: STRING_TYPE , null : true
field :user_notes_count , GraphQL :: INT_TYPE , null : true
field :should_remove_source_branch , GraphQL :: BOOLEAN_TYPE , method : :should_remove_source_branch? , null : true
field :force_remove_source_branch , GraphQL :: BOOLEAN_TYPE , method : :force_remove_source_branch? , null : true
field :merge_status , GraphQL :: STRING_TYPE , null : true
field :in_progress_merge_commit_sha , GraphQL :: STRING_TYPE , null : true
field :merge_error , GraphQL :: STRING_TYPE , null : true
field :allow_collaboration , GraphQL :: BOOLEAN_TYPE , null : true
field :should_be_rebased , GraphQL :: BOOLEAN_TYPE , method : :should_be_rebased? , null : false
field :rebase_commit_sha , GraphQL :: STRING_TYPE , null : true
2019-09-30 21:07:59 +05:30
field :rebase_in_progress , GraphQL :: BOOLEAN_TYPE , method : :rebase_in_progress? , null : false , calls_gitaly : true
2019-03-02 22:35:43 +05:30
field :merge_commit_message , GraphQL :: STRING_TYPE , method : :default_merge_commit_message , null : true , deprecation_reason : " Renamed to defaultMergeCommitMessage "
field :default_merge_commit_message , GraphQL :: STRING_TYPE , null : true
2018-11-08 19:23:39 +05:30
field :merge_ongoing , GraphQL :: BOOLEAN_TYPE , method : :merge_ongoing? , null : false
field :source_branch_exists , GraphQL :: BOOLEAN_TYPE , method : :source_branch_exists? , null : false
field :mergeable_discussions_state , GraphQL :: BOOLEAN_TYPE , null : true
field :web_url , GraphQL :: STRING_TYPE , null : true
field :upvotes , GraphQL :: INT_TYPE , null : false
field :downvotes , GraphQL :: INT_TYPE , null : false
field :subscribed , GraphQL :: BOOLEAN_TYPE , method : :subscribed? , null : false
2019-07-07 11:18:12 +05:30
field :head_pipeline , Types :: Ci :: PipelineType , null : true , method : :actual_head_pipeline
2018-11-08 19:23:39 +05:30
field :pipelines , Types :: Ci :: PipelineType . connection_type ,
resolver : Resolvers :: MergeRequestPipelinesResolver
2019-09-04 21:01:54 +05:30
field :task_completion_status , Types :: TaskCompletionStatus , null : false
2018-11-08 19:23:39 +05:30
end
end