The same as https://github.com/payloadcms/payload/pull/11763 but also for GraphQL. The previous fix was working only for the Local API and REST API due to a different method for querying joins in GraphQL.
34 lines
632 B
TypeScript
34 lines
632 B
TypeScript
import type { CollectionConfig } from 'payload'
|
|
|
|
export const versionsSlug = 'versions'
|
|
|
|
export const Versions: CollectionConfig = {
|
|
slug: versionsSlug,
|
|
fields: [
|
|
{
|
|
name: 'title',
|
|
type: 'text',
|
|
required: true,
|
|
},
|
|
{
|
|
name: 'category',
|
|
relationTo: 'categories',
|
|
type: 'relationship',
|
|
},
|
|
{
|
|
name: 'categoryVersion',
|
|
relationTo: 'categories-versions',
|
|
type: 'relationship',
|
|
},
|
|
{
|
|
name: 'categoryVersions',
|
|
relationTo: 'categories-versions',
|
|
type: 'relationship',
|
|
hasMany: true,
|
|
},
|
|
],
|
|
versions: {
|
|
drafts: true,
|
|
},
|
|
}
|