syncova-policies/lib/site-pages.server.ts
Weapie 265ca8ac38
All checks were successful
Container-Image bauen und veröffentlichen / build-and-push (push) Successful in 5m15s
Improve accessibility and access controls; verify production and database recovery
2026-09-14 11:44:41 +02:00

25 lines
624 B
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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
}