A join field on a relationship with a camelCase name would cause an error from drizzle due to the relation name not matching.
44 lines
877 B
TypeScript
44 lines
877 B
TypeScript
import type { CollectionConfig } from 'payload'
|
|
|
|
import { categoriesSlug, postsSlug, uploadsSlug } from '../shared.js'
|
|
|
|
export const Posts: CollectionConfig = {
|
|
slug: postsSlug,
|
|
admin: {
|
|
useAsTitle: 'title',
|
|
defaultColumns: ['title', 'category', 'updatedAt', 'createdAt'],
|
|
},
|
|
fields: [
|
|
{
|
|
name: 'title',
|
|
type: 'text',
|
|
},
|
|
{
|
|
name: 'upload',
|
|
type: 'upload',
|
|
relationTo: uploadsSlug,
|
|
},
|
|
{
|
|
name: 'category',
|
|
type: 'relationship',
|
|
relationTo: categoriesSlug,
|
|
},
|
|
{
|
|
name: 'group',
|
|
type: 'group',
|
|
fields: [
|
|
{
|
|
name: 'category',
|
|
type: 'relationship',
|
|
relationTo: categoriesSlug,
|
|
},
|
|
{
|
|
name: 'camelCaseCategory',
|
|
type: 'relationship',
|
|
relationTo: categoriesSlug,
|
|
},
|
|
],
|
|
},
|
|
],
|
|
}
|