62
payload/src/collections/Posts.ts
Normal file
62
payload/src/collections/Posts.ts
Normal file
@ -0,0 +1,62 @@
|
||||
import { CollectionConfig } from 'payload/types';
|
||||
|
||||
const Posts: CollectionConfig = {
|
||||
slug: 'posts',
|
||||
admin: {
|
||||
defaultColumns: ['title', 'author', 'category', 'tags', 'status'],
|
||||
useAsTitle: 'title',
|
||||
},
|
||||
access: {
|
||||
read: () => true,
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
name: 'title',
|
||||
type: 'text',
|
||||
},
|
||||
{
|
||||
name: 'author',
|
||||
type: 'relationship',
|
||||
relationTo: 'users',
|
||||
},
|
||||
{
|
||||
name: 'publishedDate',
|
||||
type: 'date',
|
||||
},
|
||||
{
|
||||
name: 'category',
|
||||
type: 'relationship',
|
||||
relationTo: 'categories'
|
||||
},
|
||||
{
|
||||
name: 'tags',
|
||||
type: 'relationship',
|
||||
relationTo: 'tags',
|
||||
hasMany: true,
|
||||
},
|
||||
{
|
||||
name: 'content',
|
||||
type: 'richText'
|
||||
},
|
||||
{
|
||||
name: 'status',
|
||||
type: 'select',
|
||||
options: [
|
||||
{
|
||||
value: 'draft',
|
||||
label: 'Draft',
|
||||
},
|
||||
{
|
||||
value: 'published',
|
||||
label: 'Published',
|
||||
},
|
||||
],
|
||||
defaultValue: 'draft',
|
||||
admin: {
|
||||
position: 'sidebar',
|
||||
}
|
||||
}
|
||||
],
|
||||
}
|
||||
|
||||
export default Posts;
|
Reference in New Issue
Block a user