Files
payload/test/joins/collections/Posts.ts
Dan Ribbens 27b1629927 fix(db-postgres, db-sqlite): joins relation name (#8491)
A join field on a relationship with a camelCase name would cause an
error from drizzle due to the relation name not matching.
2024-09-30 16:47:21 -04:00

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,
},
],
},
],
}