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:
@@ -6,11 +6,9 @@ import { writeAudit } from "@/db/audit";
|
||||
import { deleteEvent, getEventAccess } from "@/db/events";
|
||||
import { listEventVideos } from "@/db/videos";
|
||||
import { getStorageSettings } from "@/db/storage-settings";
|
||||
import { mediaStorage } from "@/lib/media-storage";
|
||||
import { eventPhotoDir } from "@/lib/event-photos";
|
||||
import {
|
||||
eventVideoArchiveDir,
|
||||
eventVideoUploadDir,
|
||||
} from "@/lib/event-videos";
|
||||
import { eventVideoArchiveDir } from "@/lib/event-videos";
|
||||
import { errorResponse, jsonResponse } from "@/lib/http";
|
||||
|
||||
/**
|
||||
@@ -34,30 +32,29 @@ export const DELETE = async (
|
||||
const deleted = await deleteEvent(id);
|
||||
if (!deleted) return errorResponse(404, "unknown event");
|
||||
|
||||
try {
|
||||
await rm(eventPhotoDir(id), { recursive: true, force: true });
|
||||
await rm(eventVideoUploadDir(id), { recursive: true, force: true });
|
||||
} catch (error) {
|
||||
console.error(`event ${id}: database deleted but files remain`, error);
|
||||
const media = await mediaStorage();
|
||||
if (media.ok) {
|
||||
try {
|
||||
await rm(eventPhotoDir(media.root, id), { recursive: true, force: true });
|
||||
} catch (error) {
|
||||
console.error(`event ${id}: database deleted but photos remain`, error);
|
||||
}
|
||||
}
|
||||
|
||||
// Video originals are the largest files; remove each one from the archive
|
||||
// after the cascade has removed its row, so a deletion cannot orphan GBs.
|
||||
// Video originals are the largest files; remove the whole event video folder
|
||||
// on the archive after the cascade has removed the rows, so a deletion cannot
|
||||
// orphan GBs. Originals and derivatives share one folder per video.
|
||||
try {
|
||||
const storage = await getStorageSettings();
|
||||
for (const video of videos) {
|
||||
await rm(
|
||||
eventVideoArchiveDir(
|
||||
storage.archivePath,
|
||||
video.archiveFolder,
|
||||
id,
|
||||
video.id,
|
||||
),
|
||||
{ recursive: true, force: true },
|
||||
);
|
||||
const folders = new Set(videos.map((video) => video.archiveFolder));
|
||||
for (const folder of folders) {
|
||||
await rm(eventVideoArchiveDir(storage.archivePath, folder, id), {
|
||||
recursive: true,
|
||||
force: true,
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`event ${id}: NFS video originals were not removed`, error);
|
||||
console.error(`event ${id}: NFS video files were not removed`, error);
|
||||
}
|
||||
|
||||
await writeAudit(db, {
|
||||
|
||||
Reference in New Issue
Block a user