summaryrefslogtreecommitdiff
path: root/app/graphql/types/projects/topic_type.rb
blob: 79ab69e794b9564cb9f9cbda9319658648270aac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# frozen_string_literal: true

module Types
  module Projects
    # rubocop: disable Graphql/AuthorizeTypes
    class TopicType < BaseObject
      graphql_name 'Topic'

      field :id, GraphQL::Types::ID, null: false,
            description: 'ID of the topic.'

      field :name, GraphQL::Types::String, null: false,
            description: 'Name of the topic.'

      field :description, GraphQL::Types::String, null: true,
            description: 'Description of the topic.'
      markdown_field :description_html, null: true

      field :avatar_url, GraphQL::Types::String, null: true,
            description: 'URL to avatar image file of the topic.'

      def avatar_url
        object.avatar_url(only_path: false)
      end
    end
    # rubocop: enable Graphql/AuthorizeTypes
  end
end