Module: Types::TodoableInterface

Includes:
BaseInterface
Defined in:
app/graphql/types/todoable_interface.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.resolve_type(object, context) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'app/graphql/types/todoable_interface.rb', line 20

def self.resolve_type(object, context)
  case object
  when User
    Types::UserType
  when WorkItem
    Types::WorkItemType
  when Issue
    Types::IssueType
  when MergeRequest
    Types::MergeRequestType
  when ::DesignManagement::Design
    Types::DesignManagement::DesignType
  when ::AlertManagement::Alert
    Types::AlertManagement::AlertType
  when Commit
    Types::Repositories::CommitType
  when Project
    Types::ProjectType
  when Group
    Types::GroupType
  when Key # SSH key
    Types::KeyType
  when WikiPage::Meta
    Types::Wikis::WikiPageType
  else
    raise "Unknown GraphQL type for #{object}"
  end
end

Instance Method Details

#nameObject



49
50
51
# File 'app/graphql/types/todoable_interface.rb', line 49

def name
  object.try(:name) || object.try(:title)
end