feat(infra): payments (Stripe), auth scaffold, engine bridge, embeds, .env.example

Env-guarded so build stays green: /api/payments/[order_id]/deposit+release + /api/webhooks/stripe (lazy Stripe, 50/50 escrow, 501 until keys); /api/auth login|me|logout (HMAC signed-session scaffold, guarded dev login); lib/engine bridges edge->FastAPI (estimates defers to ENGINE_URL when set); components/embed for NocoDB/Metabase signed URLs; .env.example full inventory. tsc 0, build green.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
2026-06-24 21:19:29 +02:00
co-authored by Claude Opus 4.8
parent 31128a71c8
commit ba96566c14
13 changed files with 281 additions and 0 deletions
+5
View File
@@ -1,5 +1,6 @@
import { NextRequest, NextResponse } from "next/server";
import { computeEstimate, type EntityType, type Frequency } from "@/lib/data";
import { engineFetch } from "@/lib/engine";
// POST /api/estimates (docs/04) — price/time/confidence for a configured job.
// Single source of truth for the estimate math; the configurator calls this.
@@ -11,6 +12,10 @@ export async function POST(req: NextRequest) {
return NextResponse.json({ error: { code: "bad_json", message: "Invalid JSON body" } }, { status: 400 });
}
// Defer to the FastAPI data engine when it's running; fall back to local math.
const eng = await engineFetch("/estimates", { method: "POST", body: JSON.stringify(body) });
if (eng && eng.ok) return NextResponse.json(await eng.json());
const markets = Array.isArray(body.markets) ? (body.markets as string[]) : [];
const entity_type = (body.entity_type as EntityType) || "Bolag";
const fields = Array.isArray(body.fields) ? (body.fields as string[]) : [];