Fixes errors when having joins with versions +drafts on `hasMany: true` relationships. Removes `joinQuery` overhead if we don't need it for the current operation. Right now, in all adapters we support joins only for `find`, `findOne`, and `queryDrafts`. Fixes https://github.com/payloadcms/payload/issues/9369
27 lines
553 B
TypeScript
27 lines
553 B
TypeScript
import type { CollectionConfig } from 'payload'
|
|
|
|
import { versionsSlug } from './Versions.js'
|
|
|
|
export const categoriesVersionsSlug = 'categories-versions'
|
|
|
|
export const CategoriesVersions: CollectionConfig = {
|
|
slug: categoriesVersionsSlug,
|
|
fields: [
|
|
{
|
|
name: 'relatedVersions',
|
|
type: 'join',
|
|
collection: versionsSlug,
|
|
on: 'categoryVersion',
|
|
},
|
|
{
|
|
name: 'relatedVersionsMany',
|
|
type: 'join',
|
|
collection: versionsSlug,
|
|
on: 'categoryVersions',
|
|
},
|
|
],
|
|
versions: {
|
|
drafts: true,
|
|
},
|
|
}
|