import { serve } from "@upstash/workflow/nextjs";
export const { POST } = serve<string>(async (context) => {
const { orderId, processingResult } = context.requestPayload;
await context.run("process-order", async () => {
// ...
})
const { notifyResponse } = await context.notify(
"notify-processing-complete",
`order-${orderId}`,
{
orderId,
status: "completed",
result: processingResult,
completedAt: new Date().toISOString()
}
);
});