diff options
Diffstat (limited to 'app/graphql/resolvers/concerns/resolves_ids.rb')
-rw-r--r-- | app/graphql/resolvers/concerns/resolves_ids.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/app/graphql/resolvers/concerns/resolves_ids.rb b/app/graphql/resolvers/concerns/resolves_ids.rb new file mode 100644 index 00000000000..8bf2a6b2ac9 --- /dev/null +++ b/app/graphql/resolvers/concerns/resolves_ids.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module ResolvesIds + extend ActiveSupport::Concern + + def resolve_ids(ids, type) + Array.wrap(ids).map do |id| + next unless id.present? + + # TODO: remove this line when the compatibility layer is removed + # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883 + id = type.coerce_isolated_input(id) + id.model_id + end.compact + end +end |