Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/graphql/types/todoable_interface.rb')
-rw-r--r--app/graphql/types/todoable_interface.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/app/graphql/types/todoable_interface.rb b/app/graphql/types/todoable_interface.rb
new file mode 100644
index 00000000000..7d437973c12
--- /dev/null
+++ b/app/graphql/types/todoable_interface.rb
@@ -0,0 +1,30 @@
+# frozen_string_literal: true
+
+module Types
+ module TodoableInterface
+ include Types::BaseInterface
+
+ graphql_name 'Todoable'
+
+ field :web_url, GraphQL::Types::String, null: true, description: 'URL of this object.'
+
+ def self.resolve_type(object, context)
+ case object
+ when Issue
+ Types::IssueType
+ when MergeRequest
+ Types::MergeRequestType
+ when ::DesignManagement::Design
+ Types::DesignManagement::DesignType
+ when ::AlertManagement::Alert
+ Types::AlertManagement::AlertType
+ when Commit
+ Types::CommitType
+ else
+ raise "Unknown GraphQL type for #{object}"
+ end
+ end
+ end
+end
+
+Types::TodoableInterface.prepend_mod