feat: add JuryMitglieder collection and migration for jury members
- Created a new collection `JuryMitglieder` with fields for name, image, quote, role, organization, bio, website, LinkedIn, sort order, active status, and published date. - Implemented access control for creating, reading, updating, and deleting jury members. - Added migration script to create necessary database tables and columns for jury members, including versioning support. - Updated existing `preistraeger` table to include new columns for award group, winner rank, sort order, and visibility settings. - Introduced a temporary global switch to control the visibility of testimonials in the SPA.
This commit is contained in:
@@ -16,7 +16,7 @@ type Args = {
|
||||
params: Promise<{ slug?: string[] }>
|
||||
}
|
||||
|
||||
type RouteCollection = Exclude<CmsRouteCollection, 'partners'>
|
||||
type RouteCollection = Exclude<CmsRouteCollection, 'partners' | 'jury-mitglieder'>
|
||||
|
||||
function routeTarget(pathname: string): { collection: RouteCollection; slug: string } {
|
||||
const parts = pathname.split('/').filter(Boolean)
|
||||
@@ -65,7 +65,7 @@ async function findList(payload: Awaited<ReturnType<typeof getPayload>>, collect
|
||||
overrideAccess: draft,
|
||||
limit: 300,
|
||||
pagination: false,
|
||||
...(collection === 'partners' ? { sort: 'sortOrder' } : {}),
|
||||
...(collection === 'partners' || collection === 'jury-mitglieder' ? { sort: 'sortOrder' } : {}),
|
||||
})
|
||||
|
||||
return result.docs
|
||||
@@ -99,7 +99,19 @@ export default async function Page({ params }: Args) {
|
||||
const pathname = `/${slug.join('/')}`.replace(/\/$/, '') || '/'
|
||||
const payload = await getPayload({ config: configPromise })
|
||||
const { isEnabled: draft } = await draftMode()
|
||||
const [header, footer, siteSettings, applicationPhase, route, supportPages, preistraeger, events, posts, partners] = await Promise.all([
|
||||
const [
|
||||
header,
|
||||
footer,
|
||||
siteSettings,
|
||||
applicationPhase,
|
||||
route,
|
||||
supportPages,
|
||||
preistraeger,
|
||||
events,
|
||||
posts,
|
||||
partners,
|
||||
juryMitglieder,
|
||||
] = await Promise.all([
|
||||
payload.findGlobal({ slug: 'header', depth: 1 }).catch(() => undefined),
|
||||
payload.findGlobal({ slug: 'footer', depth: 1 }).catch(() => undefined),
|
||||
payload.findGlobal({ slug: 'site-settings', depth: 1 }).catch(() => undefined),
|
||||
@@ -110,6 +122,7 @@ export default async function Page({ params }: Args) {
|
||||
findList(payload, 'events', draft).catch(() => []),
|
||||
findList(payload, 'posts', draft).catch(() => []),
|
||||
findList(payload, 'partners', draft).catch(() => []),
|
||||
findList(payload, 'jury-mitglieder', draft).catch(() => []),
|
||||
])
|
||||
|
||||
if (!route) notFound()
|
||||
@@ -130,6 +143,7 @@ export default async function Page({ params }: Args) {
|
||||
events: events as unknown as CmsRouteDoc[],
|
||||
posts: posts as unknown as CmsRouteDoc[],
|
||||
partners: partners as unknown as CmsRouteDoc[],
|
||||
'jury-mitglieder': juryMitglieder as unknown as CmsRouteDoc[],
|
||||
},
|
||||
}}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user