From 05514b0c99ee9a5355fe5555fe784afe9d19592c Mon Sep 17 00:00:00 2001 From: Marc Mintel Date: Tue, 5 May 2026 10:59:40 +0200 Subject: [PATCH] Fix: Remove Payload imports from blog page --- apps/web/app/(site)/blog/[slug]/page.tsx | 23 ++----------- apps/web/app/api/health/cms/route.ts | 42 ------------------------ 2 files changed, 3 insertions(+), 62 deletions(-) delete mode 100644 apps/web/app/api/health/cms/route.ts diff --git a/apps/web/app/(site)/blog/[slug]/page.tsx b/apps/web/app/(site)/blog/[slug]/page.tsx index 98cdba0..09c4cce 100644 --- a/apps/web/app/(site)/blog/[slug]/page.tsx +++ b/apps/web/app/(site)/blog/[slug]/page.tsx @@ -1,8 +1,7 @@ import * as React from "react"; import type { Metadata } from "next"; import { notFound, redirect } from "next/navigation"; -import { getPayloadHMR } from "@payloadcms/next/utilities"; -import configPromise from "@payload-config"; + import { getAllPosts } from "@/src/lib/posts"; import { BlogPostHeader } from "@/src/components/blog/BlogPostHeader"; import { Section } from "@/src/components/Section"; @@ -11,7 +10,7 @@ import { BlogPostClient } from "@/src/components/BlogPostClient"; import { TextSelectionShare } from "@/src/components/TextSelectionShare"; import { BlogPostStickyBar } from "@/src/components/blog/BlogPostStickyBar"; import { MDXContent } from "@/src/components/MDXContent"; -import { PayloadRichText } from "@/src/components/PayloadRichText"; + import { TableOfContents } from "@/src/components/TableOfContents"; export async function generateStaticParams() { @@ -58,18 +57,6 @@ export default async function BlogPostPage({ const post = allPosts.find((p) => p.slug === slug); if (!post) { - const payload = await getPayloadHMR({ config: configPromise }); - const redirectDoc = await payload.find({ - collection: "redirects", - where: { - from: { equals: slug }, - }, - }); - - if (redirectDoc.docs.length > 0) { - redirect(`/blog/${redirectDoc.docs[0].to}`); - } - notFound(); } @@ -119,11 +106,7 @@ export default async function BlogPostPage({
- {post.lexicalContent ? ( - - ) : ( - - )} +
diff --git a/apps/web/app/api/health/cms/route.ts b/apps/web/app/api/health/cms/route.ts deleted file mode 100644 index 8945064..0000000 --- a/apps/web/app/api/health/cms/route.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { NextResponse } from "next/server"; -import { getPayload } from "payload"; -import configPromise from "@payload-config"; - -export const dynamic = "force-dynamic"; - -/** - * Deep CMS Health Check - * Validates that Payload CMS can actually query the database. - * Used by post-deploy smoke tests to catch migration/schema issues. - */ -export async function GET() { - const checks: Record = {}; - - try { - const payload = await getPayload({ config: configPromise }); - checks.init = "ok"; - - // Verify each collection can be queried (catches missing locale tables, broken migrations) - // Adjusted for mintel.me collections - const collections = ["posts", "projects", "media", "inquiries"] as const; - for (const collection of collections) { - try { - await payload.find({ collection, limit: 1 }); - checks[collection] = "ok"; - } catch (e: any) { - checks[collection] = `error: ${e.message?.substring(0, 100)}`; - } - } - - const hasErrors = Object.values(checks).some((v) => v.startsWith("error")); - return NextResponse.json( - { status: hasErrors ? "degraded" : "ok", checks }, - { status: hasErrors ? 503 : 200 }, - ); - } catch (e: any) { - return NextResponse.json( - { status: "error", message: e.message?.substring(0, 200), checks }, - { status: 503 }, - ); - } -}