Implementa o MVP do Adaptador de Planilhas no Elo Pro.
O módulo usa a identidade Supabase, isola cada workspace e registra storage, TTL, runner e biblioteca XLSX como decisões ainda abertas. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
commit
6e23f1533b
144 files changed
+19060
No files matched your search
@@ -0,0 +1,22 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { errorResponse, requireReady } from "../../../_lib";
|
||||
import { rejectWorkspaceForgery, saveMappings } from "@/server/spreadsheet-adapter/service";
|
||||
import type { MappingInput } from "@/server/spreadsheet-adapter/dto";
|
||||
|
||||
export const runtime = "nodejs";
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export async function PUT(request: Request, context: { params: Promise<{ id: string }> }) {
|
||||
try {
|
||||
const { ctx, deps } = await requireReady();
|
||||
const { id } = await context.params;
|
||||
const body = (await request.json()) as { sourceId?: string; mappings?: MappingInput[]; workspace_id?: string };
|
||||
await rejectWorkspaceForgery(deps, ctx, body.workspace_id);
|
||||
if (!body.sourceId || !Array.isArray(body.mappings)) {
|
||||
return NextResponse.json({ error: { code: "MAPPING_INCOMPLETE", message: "Informe o mapeamento." } }, { status: 400 });
|
||||
}
|
||||
return NextResponse.json({ job: await saveMappings(deps, ctx, id, body.sourceId, body.mappings) });
|
||||
} catch (error) {
|
||||
return errorResponse(error);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user