Files
payload/test/_community/collections/Posts/index.ts
2024-03-01 14:07:12 -05:00

54 lines
1012 B
TypeScript

import type { CollectionConfig } from '../../../../packages/payload/src/collections/config/types'
import { mediaSlug } from '../Media'
export const postsSlug = 'posts'
export const PostsCollection: CollectionConfig = {
admin: {
useAsTitle: 'text',
},
fields: [
{
name: 'text',
type: 'text',
},
{
name: 'richText',
type: 'richText',
},
{
name: 'associatedMedia',
access: {
create: () => true,
update: () => false,
},
relationTo: mediaSlug,
type: 'upload',
},
{
name: 'blocksField',
type: 'blocks',
blocks: [
{
slug: 'block1',
fields: [
{
type: 'group',
name: 'group1',
fields: [
{
type: 'text',
name: 'group1Text',
},
],
},
],
},
],
},
],
versions: true,
slug: postsSlug,
}