summaryrefslogtreecommitdiff
path: root/app/graphql/mutations/todos/base.rb
blob: 2a72019fbac0cc7da89162b13d10c96dd0618fca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# frozen_string_literal: true

module Mutations
  module Todos
    class Base < ::Mutations::BaseMutation
      private

      def find_object(id:)
        GitlabSchema.object_from_id(id)
      end

      def map_to_global_ids(ids)
        return [] if ids.blank?

        ids.map { |id| to_global_id(id) }
      end

      def to_global_id(id)
        ::URI::GID.build(app: GlobalID.app, model_name: Todo.name, model_id: id, params: nil).to_s
      end
    end
  end
end