sing-ui/app/api/pipelines/[id]/diff/route.ts

26 lines
692 B
TypeScript

import { schemaDiff } from "@/lib/atlas";
import { getPipeline } from "@/lib/db";
export const runtime = "nodejs";
export const dynamic = "force-dynamic";
export async function GET(
_request: Request,
{ params }: { params: Promise<{ id: string }> }
) {
try {
const { id } = await params;
const pipeline = getPipeline(Number(id));
if (!pipeline) {
return Response.json({ error: "pipeline not found" }, { status: 404 });
}
const result = await schemaDiff(
pipeline.source_conn_id,
pipeline.target_conn_id
);
return Response.json(result);
} catch (err) {
return Response.json({ error: (err as Error).message }, { status: 500 });
}
}