feat(insights): POST /api/insights/[id]/create-issue thin wrapper around server action

Useful for programmatic smoke tests and future automation. Auth-gated via underlying action.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Semih
2026-05-14 05:49:20 +00:00
parent c5acdfc8ec
commit 0c6350db2d
2 changed files with 15 additions and 1 deletions

View File

@@ -0,0 +1,14 @@
import { NextResponse } from "next/server";
import { createGithubIssueForInsight } from "@/app/insights/_actions";
export const dynamic = "force-dynamic";
export async function POST(_req: Request, { params }: { params: Promise<{ id: string }> }) {
const { id } = await params;
try {
const res = await createGithubIssueForInsight(id);
return NextResponse.json({ ok: true, ...res });
} catch (e) {
return NextResponse.json({ ok: false, error: (e as Error).message }, { status: 500 });
}
}

File diff suppressed because one or more lines are too long