mirror of
https://github.com/xCyanGrizzly/DragonsStash.git
synced 2026-05-10 22:01:16 +00:00
Pattern grouping (Signal 3): - Extract YYYY-MM dates, month names, and project prefixes from filenames - Auto-group packages sharing the same pattern within a channel - Groups created with groupingSource=AUTO_PATTERN Creator grouping (Signal 4): - Auto-group 3+ ungrouped packages from the same creator within a channel - Runs after pattern grouping as lowest-priority automatic signal Notification UI: - Add NotificationBell component to header with unread badge - Popover panel shows recent notifications with severity icons - Mark individual or all notifications as read - Polls every 30 seconds for updates Failure notifications: - Upload/download failures now create SystemNotification records - Visible in the notification bell alongside hash mismatch alerts Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
28 lines
708 B
TypeScript
28 lines
708 B
TypeScript
import { NextResponse } from "next/server";
|
|
import { auth } from "@/lib/auth";
|
|
import {
|
|
getRecentNotifications,
|
|
getUnreadNotificationCount,
|
|
} from "@/data/notification.queries";
|
|
|
|
export const dynamic = "force-dynamic";
|
|
|
|
export async function GET() {
|
|
const session = await auth();
|
|
if (!session?.user?.id) {
|
|
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
|
|
}
|
|
|
|
const [notifications, unreadCount] = await Promise.all([
|
|
getRecentNotifications(30),
|
|
getUnreadNotificationCount(),
|
|
]);
|
|
|
|
const serialized = notifications.map((n) => ({
|
|
...n,
|
|
createdAt: n.createdAt.toISOString(),
|
|
}));
|
|
|
|
return NextResponse.json({ notifications: serialized, unreadCount });
|
|
}
|