Class: Types::TodoType

Inherits:
BaseObject
  • Object
show all
Defined in:
app/graphql/types/todo_type.rb

Instance Method Summary collapse

Methods inherited from BaseObject

accepts, assignable?, authorization, authorize, authorized?, #current_user, #id

Methods included from Gitlab::Graphql::Present

#present, #unpresented

Instance Method Details

#authorObject


68
69
70
# File 'app/graphql/types/todo_type.rb', line 68

def author
  Gitlab::Graphql::Loaders::BatchModelLoader.new(User, object.author_id).find
end

#groupObject


64
65
66
# File 'app/graphql/types/todo_type.rb', line 64

def group
  Gitlab::Graphql::Loaders::BatchModelLoader.new(Group, object.group_id).find
end

#projectObject


60
61
62
# File 'app/graphql/types/todo_type.rb', line 60

def project
  Gitlab::Graphql::Loaders::BatchModelLoader.new(Project, object.project_id).find
end

#targetObject


72
73
74
75
76
77
78
79
80
81
82
# File 'app/graphql/types/todo_type.rb', line 72

def target
  if object.for_commit?
    Gitlab::Graphql::Loaders::BatchCommitLoader.new(
      container_class: Project,
      container_id: object.project_id,
      oid: object.commit_id
    ).find
  else
    Gitlab::Graphql::Loaders::BatchModelLoader.new(target_type_class, object.target_id).find
  end
end