debian-mirror-gitlab/app/graphql/resolvers/design_management/version_resolver.rb

30 lines
821 B
Ruby
Raw Normal View History

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,
description: 'The Global ID of the version'
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