diff --git a/src/collections/Employees.ts b/src/collections/Employees.ts deleted file mode 100644 index 198c843..0000000 --- a/src/collections/Employees.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { CollectionConfig } from 'payload' -import { isAdminOrEmployee } from '@/collections/access/admin' - -export const Employees: CollectionConfig = { - slug: 'employees', - labels: { - singular: { - de: 'Mitarbeiter', - }, - plural: 'Mitarbeiter', - }, - fields: [ - { - name: 'photo', - label: { - de: 'Foto', - }, - type: 'upload', - relationTo: 'media', - }, - { - name: 'name', - type: 'text', - label: { - de: 'Name', - }, - required: true, - }, - { - name: 'occupation', - type: 'text', - label: { - de: 'Tätigkeit', - }, - required: true, - }, - { - name: 'email', - type: 'email', - label: { - de: 'Email', - }, - }, - { - name: 'telephone', - type: 'text', - label: { - de: 'Telefon', - }, - required: false, - }, - ], - admin: { - useAsTitle: 'name', - }, - access: { - read: () => true, - create: isAdminOrEmployee(), - update: isAdminOrEmployee(), - delete: isAdminOrEmployee(), - }, -} diff --git a/src/collections/Pages.ts b/src/collections/Pages.ts deleted file mode 100644 index c05442c..0000000 --- a/src/collections/Pages.ts +++ /dev/null @@ -1,93 +0,0 @@ -import { Block, CollectionConfig } from 'payload' -import { isAdmin, isAdminOrEmployee } from '@/collections/access/admin' - -const Content: Block = { - slug: 'content', - fields: [ - { - name: 'content', - type: 'richText', - required: true - } - ] -} - -const Title: Block = { - slug: 'title', - fields: [ - { - name: 'title', - type: 'text', - required: true, - }, - ] -} - -const Testimony: Block = { - slug: 'testimony', - labels: { - singular: { - de: 'Zeugnis' - }, - plural: { - de: 'Zeugnisse' - } - }, - fields: [ - { - name: 'testimony', - type: 'relationship', - relationTo: 'testimony', - required: true - } - ] -} - -export const Pages: CollectionConfig = { - slug: 'page', - labels: { - singular: { - de: 'Seite' - }, - plural: { - de: "Seiten" - }, - }, - fields: [ - { - name: "title", - type: "text", - required: true, - label: { - de: "Titel" - } - }, - { - name: 'slug', - type: 'text', - required: true, - label: { - de: "Slug" - } - }, - { - name: 'content', - type: 'blocks', - required: true, - blocks: [ - Content, - Title, - Testimony - ] - } - ], - admin: { - useAsTitle: "title" - }, - access: { - read: () => true, - create: isAdminOrEmployee(), - update: isAdminOrEmployee(), - delete: isAdmin(), - } -} \ No newline at end of file diff --git a/src/collections/Testimony.ts b/src/collections/Testimony.ts deleted file mode 100644 index c90d8be..0000000 --- a/src/collections/Testimony.ts +++ /dev/null @@ -1,60 +0,0 @@ -import { CollectionConfig } from 'payload' -import { isAdminOrEmployee } from '@/collections/access/admin' - -export const Testimony: CollectionConfig = { - slug: 'testimony', - labels: { - singular: { - de: 'Zeugnis', - }, - plural: { - de: 'Zeugnisse', - }, - }, - fields: [ - { - name: 'testimony', - label: { - de: 'Zeugnis', - }, - type: 'textarea', - required: true, - }, - { - name: 'name', - label: { - de: 'Name', - }, - type: 'text', - required: true, - }, - { - name: 'occupation', - label: { - de: 'Beschäftigung', - }, - type: 'text', - required: false, - }, - { - name: 'category', - label: { - de: 'Kategorie', - }, - type: 'select', - options: [ - { - value: 'EUCHARIST', - label: 'Eucharistie', - }, - ], - required: true, - }, - ], - access: { - read: () => true, - create: isAdminOrEmployee(), - update: isAdminOrEmployee(), - delete: isAdminOrEmployee(), - }, -} diff --git a/src/pageComponents/Event/Event.stories.tsx b/src/pageComponents/Event/Event.stories.tsx index b889e1e..e7f7a9f 100644 --- a/src/pageComponents/Event/Event.stories.tsx +++ b/src/pageComponents/Event/Event.stories.tsx @@ -44,7 +44,6 @@ export const WithFlyer: Story = { id: 'f1', updatedAt: "", createdAt: "", - name: 'flyer', url: "http://" } } diff --git a/src/payload.config.ts b/src/payload.config.ts index 1d9c316..ab1c09d 100644 --- a/src/payload.config.ts +++ b/src/payload.config.ts @@ -22,15 +22,12 @@ import { Media } from './collections/Media' import { Worship } from '@/collections/Worship' import { Churches } from '@/collections/Churches' import { de } from '@payloadcms/translations/languages/de' -import { Testimony } from '@/collections/Testimony' import { Parish } from '@/collections/Parish' -import { Employees } from '@/collections/Employees' import { Groups } from '@/collections/Groups' import { Events } from '@/collections/Events' import { Announcements } from '@/collections/Announcements' import { Blog } from '@/collections/Blog' import { Highlight } from '@/collections/Highlight' -import { Pages } from '@/collections/Pages' import { Documents } from '@/collections/Documents' import { Locations } from '@/collections/Locations' import { ContactPerson } from '@/collections/ContactPerson' diff --git a/src/utils/randomTestimony.ts b/src/utils/randomTestimony.ts deleted file mode 100644 index 0874028..0000000 --- a/src/utils/randomTestimony.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { getPayloadHMR } from '@payloadcms/next/utilities' -import configPromise from '@payload-config' -import { unstable_cache } from 'next/cache' - -type Category = 'EUCHARIST' - -/** - * Fetch testimonials from database - */ -const fetchTestimonies = async (type: Category) => { - const payload = await getPayloadHMR({ config: configPromise }) - return await payload.find({ - collection: 'testimony', - sort: 'createdAt', - where: { - category: { - equals: type, - }, - }, - }) -} - -/** - * Fetch a random cached testimony - */ -export const randomTestimony = async (type: Category) => { - const testimonials = await unstable_cache( - () => fetchTestimonies(type), - ['testimony', type], - { revalidate: 3600 }, - )() - const length = testimonials.docs.length - const randomIndex = Math.floor(Math.random() * length) - return testimonials.docs[randomIndex] -}