Welcome to mirror list, hosted at ThFree Co, Russian Federation.

version_resolver.rb « design_management « resolvers « graphql « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2144e5882088ed4499dff51f9c27744ba1523ca0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# frozen_string_literal: true

module Resolvers
  module DesignManagement
    class VersionResolver < BaseResolver
      include Gitlab::Graphql::Authorize::AuthorizeResource

      type Types::DesignManagement::VersionType, null: true

      authorize :read_design

      argument :id, ::Types::GlobalIDType[::DesignManagement::Version],
               required: true,
               description: 'The Global ID of the version.'

      def resolve(id:)
        authorized_find!(id: id)
      end

      def find_object(id:)
        # TODO: remove this line when the compatibility layer is removed
        # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
        id = ::Types::GlobalIDType[::DesignManagement::Version].coerce_isolated_input(id)

        GitlabSchema.find_by_gid(id)
      end
    end
  end
end