Files
glenloch-media/src/app/api/run-sheet/[instanceId]/pdf/route.ts
T
bhursey f7a0c8618f
CI / build (push) Has been cancelled
feat(media): primary media storage, growth goals, retention and delivery tools
Event photos and videos are now stored only on the NFS/local share named in
Settings -> Media storage. Uploads, photo editing, video processing and the
per-event filing step refuse to run until that share is configured and
writable, so nothing is silently written inside the container. Video
originals, renditions, posters and sidecars share one folder on the share.

Also adds volunteer growth goals with a mentor queue, an admin retention and
storage sweep with a cron entry point, cached gallery thumbnails with
per-folder ZIP downloads, a server-rendered booth-sheet PDF, and in-app
confirm/release for every upcoming assignment.

Service reminders now ignore the one-off event reminder rule, which had been
queueing an extra bogus reminder for each published service.

Generated with Codebuff 🤖
Co-Authored-By: Codebuff <noreply@codebuff.com>
2026-11-20 23:21:34 +00:00

42 lines
1.4 KiB
TypeScript

import type { NextRequest } from "next/server";
import { gateSession } from "@/auth/api";
import { getRunSheet } from "@/db/runSheet";
import { boothSheetFilename, buildBoothSheetPdf } from "@/lib/booth-sheet-pdf";
import { errorResponse } from "@/lib/http";
/**
* GET /api/run-sheet/:instanceId/pdf
*
* The printable booth sheet as a real PDF. Any signed-in team member can pull
* it (the run sheet itself is team-visible); it is generated from the current
* database state each time, so it can never show a stale team.
*/
export const GET = async (
_req: NextRequest,
{ params }: { params: Promise<{ instanceId: string }> },
) => {
const gate = await gateSession();
if (gate instanceof Response) return gate;
const { instanceId } = await params;
const sheet = await getRunSheet(instanceId);
if (!sheet) return errorResponse(404, "unknown run sheet");
try {
const pdf = await buildBoothSheetPdf(sheet);
const filename = boothSheetFilename(sheet).replace(/[^A-Za-z0-9._-]/g, "_");
return new Response(new Uint8Array(pdf), {
status: 200,
headers: {
"content-type": "application/pdf",
"content-disposition": `attachment; filename="${filename}"`,
"cache-control": "private, no-store",
"x-content-type-options": "nosniff",
},
});
} catch (error) {
console.error("[run-sheet-pdf] build failed", error);
return errorResponse(500, "could not build the booth sheet");
}
};