import { CollectionConfig } from 'payload' import { isAdminOrEmployee } from '@/collections/access/admin' import { ParagraphBlock } from '@/collections/blocks/Paragraph' import { DocumentBlock } from '@/collections/blocks/Document' import { ContactformBlock } from '@/collections/blocks/Contactform' export const Blog: CollectionConfig = { slug: 'blog', labels: { singular: { de: 'Blogpost' }, plural: { de: 'Blog' } }, fields: [ { name: 'photo', type: 'upload', relationTo: 'media', }, { name: 'title', type: 'text', required: true, label: { de: "Titel" } }, { name: 'parish', type: 'relationship', relationTo: 'parish', hasMany: true, label: { de: "Gemeinde" } }, { name: 'excerpt', type: 'textarea', label: { de: 'Auszug' }, required: true, }, { name: 'content', type: 'blocks', minRows: 1, maxRows: 20, blocks: [ ParagraphBlock, DocumentBlock, ContactformBlock ], required: true }, ], admin: { useAsTitle: 'title' }, access: { read: () => true, create: isAdminOrEmployee(), update: isAdminOrEmployee(), delete: isAdminOrEmployee(), } }