Files
payload/test/_community/collections/Posts/index.ts
Jarrod Flesch ff70fd9813 feat: draft validation (#6746)
Allows draft validation to be enabled at the config level.

You can enable this by:

```ts
// ...collectionConfig
versions: {
  drafts: {
    validate: true // defaults to false
  }
}
```
2024-06-13 11:08:04 -04:00

30 lines
568 B
TypeScript

import type { CollectionConfig } from '../../../../packages/payload/src/collections/config/types'
import { mediaSlug } from '../Media'
export const postsSlug = 'posts'
export const PostsCollection: CollectionConfig = {
defaultSort: 'title',
fields: [
{
name: 'text',
type: 'text',
},
{
name: 'title',
type: 'text',
},
{
name: 'associatedMedia',
access: {
create: () => true,
update: () => false,
},
relationTo: mediaSlug,
type: 'upload',
},
],
slug: postsSlug,
}