- Extract reusable pushCardToMonday() that creates or updates Monday items - New /api/integrations/monday/push/[id] endpoint for single-card push - New /api/integrations/monday/sync-all endpoint for bulk push of all unsynced cards (ocrStatus=complete, no mondayItemId) - Add "Push to Monday.com" button on card detail page header (shows "Update Monday" when card already has a Monday item) - Add "Push All to Monday.com" button in Monday.com settings card Made-with: Cursor
21 lines
650 B
TypeScript
21 lines
650 B
TypeScript
import { NextRequest, NextResponse } from "next/server";
|
|
import { pushCardToMonday } from "@/lib/integrations";
|
|
|
|
export async function POST(
|
|
_request: NextRequest,
|
|
{ params }: { params: Promise<{ id: string }> }
|
|
) {
|
|
try {
|
|
const { id } = await params;
|
|
const result = await pushCardToMonday(id);
|
|
return NextResponse.json({
|
|
ok: true,
|
|
action: result.action,
|
|
mondayItemId: result.mondayItemId,
|
|
});
|
|
} catch (error) {
|
|
console.error("[monday/push POST]", error);
|
|
const message = error instanceof Error ? error.message : "Push failed";
|
|
return NextResponse.json({ error: message }, { status: 500 });
|
|
}
|
|
}
|