2019-02-15 15:39:39 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Types
|
|
|
|
class IssueType < BaseObject
|
|
|
|
graphql_name 'Issue'
|
|
|
|
|
2019-05-18 00:54:41 +05:30
|
|
|
authorize :read_issue
|
|
|
|
|
|
|
|
expose_permissions Types::PermissionTypes::Issue
|
|
|
|
|
2019-02-15 15:39:39 +05:30
|
|
|
present_using IssuePresenter
|
|
|
|
|
|
|
|
field :iid, GraphQL::ID_TYPE, null: false
|
|
|
|
field :title, GraphQL::STRING_TYPE, null: false
|
|
|
|
field :description, GraphQL::STRING_TYPE, null: true
|
2019-05-18 00:54:41 +05:30
|
|
|
field :state, IssueStateEnum, null: false
|
2019-02-15 15:39:39 +05:30
|
|
|
|
|
|
|
field :author, Types::UserType,
|
|
|
|
null: false,
|
2019-05-18 00:54:41 +05:30
|
|
|
resolve: -> (obj, _args, _ctx) { Gitlab::Graphql::Loaders::BatchModelLoader.new(User, obj.author_id).find }
|
2019-02-15 15:39:39 +05:30
|
|
|
|
|
|
|
field :assignees, Types::UserType.connection_type, null: true
|
|
|
|
|
|
|
|
field :labels, Types::LabelType.connection_type, null: true
|
|
|
|
field :milestone, Types::MilestoneType,
|
|
|
|
null: true,
|
2019-05-18 00:54:41 +05:30
|
|
|
resolve: -> (obj, _args, _ctx) { Gitlab::Graphql::Loaders::BatchModelLoader.new(Milestone, obj.milestone_id).find }
|
2019-02-15 15:39:39 +05:30
|
|
|
|
|
|
|
field :due_date, Types::TimeType, null: true
|
|
|
|
field :confidential, GraphQL::BOOLEAN_TYPE, null: false
|
|
|
|
field :discussion_locked, GraphQL::BOOLEAN_TYPE,
|
|
|
|
null: false,
|
|
|
|
resolve: -> (obj, _args, _ctx) { !!obj.discussion_locked }
|
|
|
|
|
|
|
|
field :upvotes, GraphQL::INT_TYPE, null: false
|
|
|
|
field :downvotes, GraphQL::INT_TYPE, null: false
|
|
|
|
field :user_notes_count, GraphQL::INT_TYPE, null: false
|
|
|
|
field :web_url, GraphQL::STRING_TYPE, null: false
|
|
|
|
|
|
|
|
field :closed_at, Types::TimeType, null: true
|
|
|
|
|
|
|
|
field :created_at, Types::TimeType, null: false
|
|
|
|
field :updated_at, Types::TimeType, null: false
|
|
|
|
end
|
|
|
|
end
|