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:
14
apps/web/src/app/api/insights/[id]/create-issue/route.ts
Normal file
14
apps/web/src/app/api/insights/[id]/create-issue/route.ts
Normal 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
Reference in New Issue
Block a user