mirror of
https://github.com/xCyanGrizzly/DragonsStash.git
synced 2026-06-09 18:51:16 +00:00
Manual file upload:
- Upload dialog in STL page with drag-and-drop file picker
- Files saved to shared Docker volume (/data/uploads)
- Worker processes via pg_notify('manual_upload') channel
- Hashes, reads metadata, splits >2GB, uploads to Telegram
- Multiple files automatically grouped
- Status polling shows upload/processing/complete states
Notification fixes:
- Add dismiss (X) button on each notification
- Add "Clear" button to remove all notifications
- Fix false positive MISSING_PART alerts from legacy packages
(only flag when >1 destMessageIds stored but count wrong,
not when only 1 ID from backfill)
Infrastructure:
- ManualUpload + ManualUploadFile schema + migration
- Shared manual_uploads Docker volume between app and worker
- Upload API routes (POST /api/uploads, GET /api/uploads/[id])
- Worker manual-upload processor with full pipeline
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
34 lines
905 B
TypeScript
34 lines
905 B
TypeScript
import { NextResponse } from "next/server";
|
|
import { auth } from "@/lib/auth";
|
|
import {
|
|
markNotificationRead,
|
|
markAllNotificationsRead,
|
|
dismissNotification,
|
|
clearAllNotifications,
|
|
} from "@/data/notification.queries";
|
|
|
|
export const dynamic = "force-dynamic";
|
|
|
|
export async function POST(request: Request) {
|
|
const session = await auth();
|
|
if (!session?.user?.id) {
|
|
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
|
|
}
|
|
|
|
const body = await request.json().catch(() => ({}));
|
|
const id = body.id as string | undefined;
|
|
const action = (body.action as string) ?? "read";
|
|
|
|
if (action === "dismiss" && id) {
|
|
await dismissNotification(id);
|
|
} else if (action === "clear") {
|
|
await clearAllNotifications();
|
|
} else if (id) {
|
|
await markNotificationRead(id);
|
|
} else {
|
|
await markAllNotificationsRead();
|
|
}
|
|
|
|
return NextResponse.json({ success: true });
|
|
}
|