fix(recovery): restore source removed by production documentation merge

This commit is contained in:
2026-11-10 03:42:10 +01:00
parent 585bdd4b44
commit 3d2fc6f913
957 changed files with 115754 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
import { NextResponse } from "next/server";
// GET /api/uploads — list uploaded files. Returns 501 until storage is configured.
export async function GET() {
const haveR2 = process.env.R2_ACCESS_KEY_ID && process.env.R2_BUCKET && process.env.R2_ENDPOINT;
if (!haveR2) {
return NextResponse.json([], { status: 501 });
}
return NextResponse.json([]);
}
// POST /api/uploads (docs/04) — issue a presigned R2 PUT URL. Env-guarded:
// returns 501 until R2 storage is configured, and until presign generation
// is implemented — a configured-but-unimplemented state must not report
// success. Client then PUTs the file directly.
export async function POST() {
const haveR2 = process.env.R2_ACCESS_KEY_ID && process.env.R2_BUCKET && process.env.R2_ENDPOINT;
if (!haveR2) {
return NextResponse.json(
{ error: { code: "storage_not_configured", message: "Filuppladdning aktiveras när R2/Blob är kopplat" } },
{ status: 501 },
);
}
// TODO: presigned PUT generation not implemented yet — keep returning 501
// instead of a fake 200/null success shape until real R2 presign wiring exists.
return NextResponse.json(
{ error: { code: "storage_not_configured", message: "Presignerad uppladdning är inte implementerad än" } },
{ status: 501 },
);
}