2020-05-24 23:13:21 +05:30
|
|
|
# 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
|
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
argument :id, ::Types::GlobalIDType[::DesignManagement::Version],
|
2020-05-24 23:13:21 +05:30
|
|
|
required: true,
|
2021-10-27 15:23:28 +05:30
|
|
|
description: 'Global ID of the version.'
|
2020-05-24 23:13:21 +05:30
|
|
|
|
|
|
|
def resolve(id:)
|
|
|
|
authorized_find!(id: id)
|
|
|
|
end
|
|
|
|
|
|
|
|
def find_object(id:)
|
2021-01-29 00:20:46 +05:30
|
|
|
# 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)
|
2020-05-24 23:13:21 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|