summaryrefslogtreecommitdiff
path: root/app/graphql/types/projects/topic_type.rb
blob: c579f2f2b9d24d692cb53bb69c909c0cbc291c50 (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
29
# 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.'

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

      markdown_field :description_html, null: true

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