2019-12-26 22:10:19 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Mutations
|
|
|
|
module Todos
|
|
|
|
class Base < ::Mutations::BaseMutation
|
|
|
|
private
|
|
|
|
|
|
|
|
def find_object(id:)
|
2021-01-03 14:25:43 +05:30
|
|
|
# TODO: remove this line when the compatibility layer is removed
|
|
|
|
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
|
|
|
|
id = ::Types::GlobalIDType[::Todo].coerce_isolated_input(id)
|
|
|
|
GitlabSchema.find_by_gid(id)
|
2019-12-26 22:10:19 +05:30
|
|
|
end
|
|
|
|
|
2020-01-01 13:55:28 +05:30
|
|
|
def map_to_global_ids(ids)
|
|
|
|
return [] if ids.blank?
|
|
|
|
|
|
|
|
ids.map { |id| to_global_id(id) }
|
|
|
|
end
|
|
|
|
|
2019-12-26 22:10:19 +05:30
|
|
|
def to_global_id(id)
|
2021-01-03 14:25:43 +05:30
|
|
|
Gitlab::GlobalId.as_global_id(id, model_name: Todo.name).to_s
|
2019-12-26 22:10:19 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|