fix: build

This commit is contained in:
Benno Tielen 2025-02-24 09:51:08 +01:00
parent 010134a626
commit 557318afee
6 changed files with 0 additions and 254 deletions

View file

@ -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(),
},
}

View file

@ -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(),
}
}

View file

@ -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(),
},
}

View file

@ -44,7 +44,6 @@ export const WithFlyer: Story = {
id: 'f1',
updatedAt: "",
createdAt: "",
name: 'flyer',
url: "http://"
}
}

View file

@ -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'

View file

@ -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]
}