church-website/src/collections/Prayers.ts
2026-03-06 13:29:11 +01:00

38 lines
757 B
TypeScript

import { CollectionConfig } from 'payload'
import { revalidateTag } from 'next/cache'
import { isAdminOrEmployee } from '@/collections/access/admin'
export const Prayers: CollectionConfig = {
slug: 'prayers',
labels: {
singular: {
de: 'Stoßgebet',
},
plural: {
de: 'Stoßgebete',
},
},
fields: [
{
name: 'text',
type: 'text',
required: true,
label: {
de: 'Gebet',
},
},
],
admin: {
useAsTitle: 'text',
},
access: {
read: () => true,
create: isAdminOrEmployee(),
update: isAdminOrEmployee(),
delete: isAdminOrEmployee(),
},
hooks: {
afterChange: [() => revalidateTag('prayers')],
afterDelete: [() => revalidateTag('prayers')],
},
}