All checks were successful
Container-Image bauen und veröffentlichen / build-and-push (push) Successful in 5m15s
25 lines
624 B
TypeScript
25 lines
624 B
TypeScript
|
||
import {
|
||
EMPTY_SITE_PAGES,
|
||
SITE_MEDIA,
|
||
SITE_PAGES,
|
||
SitePagesContent,
|
||
} from '@/lib/site-pages'
|
||
|
||
// Prisma client instance
|
||
import { prisma } from "@/lib/prisma"
|
||
|
||
/**
|
||
* Liest die Inhalte der rechtlichen Seiten (id = 1). Fehlt der Datensatz,
|
||
* kommen leere Texte zurück – die Seiten liefern dann 404.
|
||
*/
|
||
export async function readSitePages(): Promise<SitePagesContent> {
|
||
const row = await prisma.sitePages.findUnique({ where: { id: 1 } })
|
||
|
||
if (!row) return { ...EMPTY_SITE_PAGES }
|
||
|
||
return Object.fromEntries(
|
||
[...SITE_PAGES, ...SITE_MEDIA].map((key) => [key, row[key] ?? ''])
|
||
) as SitePagesContent
|
||
}
|