diff options
Diffstat (limited to 'app/graphql/types/noteable_type.rb')
-rw-r--r-- | app/graphql/types/noteable_type.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/app/graphql/types/noteable_type.rb b/app/graphql/types/noteable_type.rb new file mode 100644 index 00000000000..859de86d6b8 --- /dev/null +++ b/app/graphql/types/noteable_type.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +module Types + class NoteableType < BaseUnion + graphql_name 'NoteableType' + description 'Represents an object that supports notes.' + + possible_types Types::IssueType, Types::DesignManagement::DesignType, Types::MergeRequestType + + def self.resolve_type(object, context) + case object + when Issue + Types::IssueType + when ::DesignManagement::Design + Types::DesignManagement::DesignType + when MergeRequest + Types::MergeRequestType + else + raise 'Unsupported issuable type' + end + end + end +end |