feat(m5): notifications & activity log foundation

- Expand NotificationRepository (unread list paginated, count, markRead
  ownership-scoped); new ActivityLogRepository (create, findByProject
  paginated) with deterministic created_at+id ordering
- NotificationService (notifyOnEvent, resolveTargets for 8 event types,
  injectable SseBroadcaster for M8) + ActivityLogService (logActivity,
  listByProject)
- NotificationEvent/SseEvent/SseBroadcaster types in lib/types
- APIs: GET /api/notifications, POST /api/notifications/:id/read,
  GET /api/projects/:projectId/activity
- Screens: notifications list + MarkReadButton, NotificationBadge in
  Header, project activity page + ProjectNav link
- Unit tests for both repositories and services (28 new)
This commit is contained in:
Ken Yasue
2026-06-25 01:20:24 +02:00
parent 95722e99f1
commit 3e02feb221
20 changed files with 1197 additions and 3 deletions

View File

@ -0,0 +1,27 @@
import { redirect } from 'next/navigation';
import { getCurrentUser, toPublicUser } from '@/lib/auth/getCurrentUser';
import { createNotificationService } from '@/lib/api/services';
import { Header } from '@/components/layout/Header';
import { NotificationList } from '@/components/notifications/NotificationList';
export const dynamic = 'force-dynamic';
export default async function NotificationsPage() {
const user = await getCurrentUser();
if (!user) {
redirect('/login');
}
const service = createNotificationService();
const { items } = service.listUnread(user.id, 1);
return (
<div className="min-h-screen bg-gray-50">
<Header user={toPublicUser(user)} />
<main className="mx-auto max-w-2xl space-y-6 p-6">
<h1 className="text-2xl font-bold"></h1>
<NotificationList notifications={items} />
</main>
</div>
);
}