From 954b123ce31006f24ae94e9d6f0011ad63de2f7e Mon Sep 17 00:00:00 2001 From: hallelx2 Date: Fri, 3 Jul 2026 13:15:02 +0100 Subject: [PATCH] =?UTF-8?q?fix(dashboard):=20section=20detail=20404=20?= =?UTF-8?q?=E2=80=94=20use=20flat=20/v1/sections/{id}?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The section-detail API route forwarded to /v1/documents/{docId}/sections/ {id}, which the engine does not expose (it only has the flat /v1/sections/{id}, scoped by the org header). Every section-detail view returned 'Section not found'. Point it at the correct endpoint. --- .../documents/[docId]/sections/[sectionId]/route.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/web/app/api/dashboard/documents/[docId]/sections/[sectionId]/route.ts b/apps/web/app/api/dashboard/documents/[docId]/sections/[sectionId]/route.ts index 14d03be..98021f0 100644 --- a/apps/web/app/api/dashboard/documents/[docId]/sections/[sectionId]/route.ts +++ b/apps/web/app/api/dashboard/documents/[docId]/sections/[sectionId]/route.ts @@ -5,10 +5,11 @@ export async function GET( _request: NextRequest, { params }: { params: Promise<{ docId: string; sectionId: string }> }, ) { - const { docId, sectionId } = await params; - const { ok, status, data } = await forwardToCP( - `/v1/documents/${docId}/sections/${sectionId}`, - ); + // The engine exposes sections at the flat /v1/sections/{id} path (scoped + // by the org header), not nested under the document. docId is only part + // of the dashboard URL/breadcrumb. + const { sectionId } = await params; + const { ok, status, data } = await forwardToCP(`/v1/sections/${sectionId}`); if (!ok) { return NextResponse.json(data ?? { error: "Upstream error" }, { status }); }