- SearchService (cross-resource keyword search across board/chat/todo/file/ event/meeting/milestone/note with type filter, project isolation) - DashboardService (project dashboard: in-progress todos, near-due(7d), latest chat/board/notes/files(5), next meeting, milestones w/ progress, recent activity(10); personal dashboard: my projects, incomplete todos, upcoming meetings, unread notifications, overdue tasks, recent activity) - CalendarRepository.findByProject - APIs: GET /api/projects/:projectId/search, GET /api/dashboard - Screens: complete personal dashboard, complete project overview, search page + SearchForm, ProjectNav 検索 link - Unit tests (SearchService, DashboardService) + e2e dashboard
20 lines
618 B
TypeScript
20 lines
618 B
TypeScript
import { NextResponse } from 'next/server';
|
|
import { getCurrentUser } from '@/lib/auth/getCurrentUser';
|
|
import { createDashboardService } from '@/lib/api/services';
|
|
import { UnauthorizedError } from '@/lib/errors';
|
|
import { handleApiError } from '@/lib/api/handleError';
|
|
|
|
export const runtime = 'nodejs';
|
|
|
|
export async function GET() {
|
|
const user = await getCurrentUser();
|
|
if (!user) return handleApiError(new UnauthorizedError());
|
|
|
|
const service = createDashboardService();
|
|
try {
|
|
return NextResponse.json(service.getPersonalDashboard(user.id));
|
|
} catch (error) {
|
|
return handleApiError(error);
|
|
}
|
|
}
|