feat(media): primary media storage, growth goals, retention and delivery tools
CI / build (push) Has been cancelled
CI / build (push) Has been cancelled
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>
This commit is contained in:
@@ -11,6 +11,7 @@ import {
|
||||
photoContentDisposition,
|
||||
} from "@/lib/event-photos";
|
||||
import { errorResponse } from "@/lib/http";
|
||||
import { mediaStorage } from "@/lib/media-storage";
|
||||
|
||||
/**
|
||||
* GET /api/events/:id/download
|
||||
@@ -22,7 +23,7 @@ import { errorResponse } from "@/lib/http";
|
||||
* Anyone assigned to the event (or a manager) can download it.
|
||||
*/
|
||||
export const GET = async (
|
||||
_req: NextRequest,
|
||||
req: NextRequest,
|
||||
{ params }: { params: Promise<{ id: string }> },
|
||||
) => {
|
||||
const gate = await gateSession();
|
||||
@@ -32,9 +33,17 @@ export const GET = async (
|
||||
const access = await getEventAccess(id, gate.id, gate.systemRole);
|
||||
if (!access) return errorResponse(404, "unknown event");
|
||||
|
||||
const photos = await listEventPhotosForArchive(id);
|
||||
// `?folderId=` narrows the archive to one folder, so a photographer can pull
|
||||
// just the shots they need without downloading the whole event.
|
||||
const folderId = req.nextUrl.searchParams.get("folderId")?.trim() || null;
|
||||
const photos = (await listEventPhotosForArchive(id)).filter(
|
||||
(photo) => !folderId || photo.folderId === folderId,
|
||||
);
|
||||
if (photos.length === 0) {
|
||||
return errorResponse(404, "this event has no photos");
|
||||
return errorResponse(
|
||||
404,
|
||||
folderId ? "this folder has no photos" : "this event has no photos",
|
||||
);
|
||||
}
|
||||
|
||||
// Originals claim their names first, then generated edits join the same
|
||||
@@ -71,9 +80,12 @@ export const GET = async (
|
||||
filename: entry.filename,
|
||||
})),
|
||||
);
|
||||
const storage = await mediaStorage();
|
||||
if (!storage.ok) return errorResponse(503, storage.message);
|
||||
|
||||
const available: { path: string; name: string }[] = [];
|
||||
for (const entry of entries) {
|
||||
const filePath = eventPhotoPath(entry.storedName);
|
||||
const filePath = eventPhotoPath(storage.root, entry.storedName);
|
||||
try {
|
||||
const info = await stat(filePath);
|
||||
if (!info.isFile()) continue;
|
||||
@@ -111,7 +123,11 @@ export const GET = async (
|
||||
headers: {
|
||||
"content-type": "application/zip",
|
||||
"content-disposition": photoContentDisposition(
|
||||
eventArchiveFilename(access.event.title),
|
||||
eventArchiveFilename(
|
||||
folderId
|
||||
? `${access.event.title} - ${photos[0].folderName}`
|
||||
: access.event.title,
|
||||
),
|
||||
false,
|
||||
),
|
||||
"cache-control": "private, no-store",
|
||||
|
||||
Reference in New Issue
Block a user