debian-mirror-gitlab/app/graphql/types/notes/discussion_type.rb

24 lines
868 B
Ruby
Raw Normal View History

2019-09-04 21:01:54 +05:30
# frozen_string_literal: true
module Types
module Notes
class DiscussionType < BaseObject
graphql_name 'Discussion'
authorize :read_note
2019-12-04 20:38:33 +05:30
field :id, GraphQL::ID_TYPE, null: false # rubocop:disable Graphql/Descriptions
2019-09-30 21:07:59 +05:30
field :reply_id, GraphQL::ID_TYPE, null: false, description: 'The ID used to reply to this discussion'
2019-12-04 20:38:33 +05:30
field :created_at, Types::TimeType, null: false # rubocop:disable Graphql/Descriptions
2019-09-04 21:01:54 +05:30
field :notes, Types::Notes::NoteType.connection_type, null: false, description: "All notes in the discussion"
2019-09-30 21:07:59 +05:30
# The gem we use to generate Global IDs is hard-coded to work with
# `id` properties. To generate a GID for the `reply_id` property,
# we must use the ::Gitlab::GlobalId module.
def reply_id
::Gitlab::GlobalId.build(object, id: object.reply_id)
end
2019-09-04 21:01:54 +05:30
end
end
end