2019-02-15 15:39:39 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Types
|
|
|
|
class IssueType < BaseObject
|
2019-05-30 16:15:17 +05:30
|
|
|
graphql_name 'Issue'
|
|
|
|
|
2019-09-04 21:01:54 +05:30
|
|
|
implements(Types::Notes::NoteableType)
|
|
|
|
|
2019-07-07 11:18:12 +05:30
|
|
|
authorize :read_issue
|
|
|
|
|
|
|
|
expose_permissions Types::PermissionTypes::Issue
|
|
|
|
|
2019-02-15 15:39:39 +05:30
|
|
|
present_using IssuePresenter
|
|
|
|
|
2019-12-04 20:38:33 +05:30
|
|
|
field :iid, GraphQL::ID_TYPE, null: false # rubocop:disable Graphql/Descriptions
|
|
|
|
field :title, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions
|
2019-09-30 21:07:59 +05:30
|
|
|
markdown_field :title_html, null: true
|
2019-12-04 20:38:33 +05:30
|
|
|
field :description, GraphQL::STRING_TYPE, null: true # rubocop:disable Graphql/Descriptions
|
2019-09-30 21:07:59 +05:30
|
|
|
markdown_field :description_html, null: true
|
2019-12-04 20:38:33 +05:30
|
|
|
field :state, IssueStateEnum, null: false # rubocop:disable Graphql/Descriptions
|
2019-02-15 15:39:39 +05:30
|
|
|
|
2019-12-04 20:38:33 +05:30
|
|
|
field :reference, GraphQL::STRING_TYPE, null: false, method: :to_reference do # rubocop:disable Graphql/Descriptions
|
|
|
|
argument :full, GraphQL::BOOLEAN_TYPE, required: false, default_value: false # rubocop:disable Graphql/Descriptions
|
2019-09-04 21:01:54 +05:30
|
|
|
end
|
|
|
|
|
2019-12-04 20:38:33 +05:30
|
|
|
field :author, Types::UserType, # rubocop:disable Graphql/Descriptions
|
2019-02-15 15:39:39 +05:30
|
|
|
null: false,
|
2019-07-07 11:18:12 +05:30
|
|
|
resolve: -> (obj, _args, _ctx) { Gitlab::Graphql::Loaders::BatchModelLoader.new(User, obj.author_id).find }
|
2019-02-15 15:39:39 +05:30
|
|
|
|
2019-07-31 22:56:46 +05:30
|
|
|
# Remove complexity when BatchLoader is used
|
2019-12-04 20:38:33 +05:30
|
|
|
field :assignees, Types::UserType.connection_type, null: true, complexity: 5 # rubocop:disable Graphql/Descriptions
|
2019-02-15 15:39:39 +05:30
|
|
|
|
2019-07-31 22:56:46 +05:30
|
|
|
# Remove complexity when BatchLoader is used
|
2019-12-04 20:38:33 +05:30
|
|
|
field :labels, Types::LabelType.connection_type, null: true, complexity: 5 # rubocop:disable Graphql/Descriptions
|
|
|
|
field :milestone, Types::MilestoneType, # rubocop:disable Graphql/Descriptions
|
2019-02-15 15:39:39 +05:30
|
|
|
null: true,
|
2019-07-07 11:18:12 +05:30
|
|
|
resolve: -> (obj, _args, _ctx) { Gitlab::Graphql::Loaders::BatchModelLoader.new(Milestone, obj.milestone_id).find }
|
2019-02-15 15:39:39 +05:30
|
|
|
|
2019-12-04 20:38:33 +05:30
|
|
|
field :due_date, Types::TimeType, null: true # rubocop:disable Graphql/Descriptions
|
|
|
|
field :confidential, GraphQL::BOOLEAN_TYPE, null: false # rubocop:disable Graphql/Descriptions
|
|
|
|
field :discussion_locked, GraphQL::BOOLEAN_TYPE, # rubocop:disable Graphql/Descriptions
|
2019-02-15 15:39:39 +05:30
|
|
|
null: false,
|
|
|
|
resolve: -> (obj, _args, _ctx) { !!obj.discussion_locked }
|
|
|
|
|
2019-12-04 20:38:33 +05:30
|
|
|
field :upvotes, GraphQL::INT_TYPE, null: false # rubocop:disable Graphql/Descriptions
|
|
|
|
field :downvotes, GraphQL::INT_TYPE, null: false # rubocop:disable Graphql/Descriptions
|
|
|
|
field :user_notes_count, GraphQL::INT_TYPE, null: false # rubocop:disable Graphql/Descriptions
|
|
|
|
field :web_path, GraphQL::STRING_TYPE, null: false, method: :issue_path # rubocop:disable Graphql/Descriptions
|
|
|
|
field :web_url, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions
|
|
|
|
field :relative_position, GraphQL::INT_TYPE, null: true # rubocop:disable Graphql/Descriptions
|
2019-02-15 15:39:39 +05:30
|
|
|
|
2019-12-04 20:38:33 +05:30
|
|
|
field :closed_at, Types::TimeType, null: true # rubocop:disable Graphql/Descriptions
|
2019-02-15 15:39:39 +05:30
|
|
|
|
2019-12-04 20:38:33 +05:30
|
|
|
field :created_at, Types::TimeType, null: false # rubocop:disable Graphql/Descriptions
|
|
|
|
field :updated_at, Types::TimeType, null: false # rubocop:disable Graphql/Descriptions
|
2019-09-04 21:01:54 +05:30
|
|
|
|
2019-12-04 20:38:33 +05:30
|
|
|
field :task_completion_status, Types::TaskCompletionStatus, null: false # rubocop:disable Graphql/Descriptions
|
2019-02-15 15:39:39 +05:30
|
|
|
end
|
|
|
|
end
|
2019-12-04 20:38:33 +05:30
|
|
|
|
|
|
|
Types::IssueType.prepend_if_ee('::EE::Types::IssueType')
|