church-website/src/payload.config.ts
2026-03-06 15:37:10 +01:00

167 lines
4.3 KiB
TypeScript

// storage-adapter-import-placeholder
import {
lexicalEditor,
BoldFeature,
InlineToolbarFeature,
ItalicFeature,
UnderlineFeature,
ParagraphFeature,
HeadingFeature,
AlignFeature,
UnorderedListFeature,
LinkFeature,
HTMLConverterFeature,
} from '@payloadcms/richtext-lexical'
import path from 'path'
import { buildConfig } from 'payload'
import { fileURLToPath } from 'url'
import sharp from 'sharp'
import { Users } from './collections/Users'
import { Media } from './collections/Media'
import { Worship } from '@/collections/Worship'
import { Churches } from '@/collections/Churches'
import { de } from '@payloadcms/translations/languages/de'
import { Parish } from '@/collections/Parish'
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 { Documents } from '@/collections/Documents'
import { Locations } from '@/collections/Locations'
import { ContactPerson } from '@/collections/ContactPerson'
import { postgresAdapter } from '@payloadcms/db-postgres'
import { gcsStorage } from '@payloadcms/storage-gcs'
import { PopesPrayerIntentions } from '@/collections/PopesPrayerIntentions'
import { LiturgicalCalendar } from '@/collections/LiturgicalCalendar'
import { Classifieds } from '@/collections/Classifieds'
import { MenuGlobal } from '@/globals/Menu'
import { FooterGlobal } from '@/globals/Footer'
import { DesignGlobal } from '@/globals/Design'
import { SiteConfigGlobal } from '@/globals/SiteConfig'
import { Magazine } from '@/collections/Magazine'
import { DonationForms } from '@/collections/DonationForms'
import { Pages } from '@/collections/Pages'
import { Prayers } from '@/collections/Prayers'
const filename = fileURLToPath(import.meta.url)
const dirname = path.dirname(filename)
export default buildConfig({
admin: {
user: Users.slug,
meta: {
title: 'Dashboard',
titleSuffix: '- Heilige Drei Könige'
},
importMap: {
baseDir: dirname,
},
components: {
/*views: {
testCustomView: {
Component: '/admin/components/test/TestView',
path: '/test'
},
},*/
graphics: {
Logo: {
path: '/components/Logo/Logo',
serverProps: {
withText: true,
height: 90
}
},
Icon: {
path: '/components/Logo/Logo',
serverProps: {
height: 18
}
}
}
}
},
collections: [
Parish,
Churches,
Worship,
PopesPrayerIntentions,
Announcements,
LiturgicalCalendar,
Blog,
Highlight,
Events,
Classifieds,
ContactPerson,
Locations,
Groups,
DonationForms,
Pages,
Prayers,
Magazine,
Documents,
Media,
Users,
],
globals: [
MenuGlobal,
FooterGlobal,
DesignGlobal,
SiteConfigGlobal,
],
graphQL: {
disable: true
},
editor: lexicalEditor(
{
features: () => [
BoldFeature(),
ItalicFeature(),
UnderlineFeature(),
HeadingFeature({ enabledHeadingSizes: ["h3","h4","h5"]}),
AlignFeature(),
UnorderedListFeature(),
LinkFeature(),
ParagraphFeature(),
InlineToolbarFeature(),
HTMLConverterFeature()
]
}
),
secret: process.env.PAYLOAD_SECRET || '',
typescript: {
outputFile: path.resolve(dirname, 'payload-types.ts'),
},
i18n: {
supportedLanguages: { de },
},
db: postgresAdapter({
idType: "uuid",
push: true,
pool: {
connectionString: process.env.DATABASE_URI,
}
}),
sharp,
plugins: [
gcsStorage({
collections: {
media: {
disablePayloadAccessControl: true,
prefix: 'media/',
generateFileURL: args => `https://storage.googleapis.com/${process.env.GOOGLE_BUCKET}/media/${args.filename}`
},
documents: {
disablePayloadAccessControl: true,
prefix: 'documents/',
generateFileURL: args => `https://storage.googleapis.com/${process.env.GOOGLE_BUCKET}/documents/${args.filename}`
},
},
bucket: process.env.GOOGLE_BUCKET || "",
options: {},
acl: undefined
})
],
})