Commit da30fdb5 authored by Alex Kalderimis's avatar Alex Kalderimis

Connect designs-at-version to versions

parent a8163733
......@@ -2,19 +2,36 @@
module Types
module DesignManagement
class VersionType < BaseObject
class VersionType < ::Types::BaseObject
# Just `Version` might be a bit to general to expose globally so adding
# a `Design` prefix to specify the class exposed in GraphQL
graphql_name 'DesignVersion'
description 'A specific version in which designs were added, modified or deleted'
authorize :read_design
field :id, GraphQL::ID_TYPE, null: false,
description: 'ID of the design version'
field :sha, GraphQL::ID_TYPE, null: false,
description: 'SHA of the design version'
field :designs, Types::DesignManagement::DesignType.connection_type, null: false,
field :designs,
::Types::DesignManagement::DesignType.connection_type,
null: false,
description: 'All designs that were changed in the version'
field :designs_at_version,
::Types::DesignManagement::DesignAtVersionType.connection_type,
null: false,
description: 'All designs that are visible at this version, as of this version',
resolver: ::Resolvers::DesignManagement::Version::DesignsAtVersionResolver
field :design_at_version,
::Types::DesignManagement::DesignAtVersionType,
null: false,
description: 'A particular design as of this version, provided it is visible at this version',
resolver: ::Resolvers::DesignManagement::Version::DesignsAtVersionResolver.single
end
end
end
......@@ -3,7 +3,11 @@
require 'spec_helper'
describe GitlabSchema.types['DesignVersion'] do
let(:expected_fields) do
%i[id sha designs design_at_version designs_at_version]
end
it { expect(described_class).to require_graphql_authorizations(:read_design) }
it { expect(described_class).to have_graphql_fields(:id, :sha, :designs) }
it { expect(described_class).to have_graphql_fields(*expected_fields) }
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment