import { NextResponse } from 'next/server'; import { getClients } from '@/lib/clients'; import { getAccountConfig } from '@/lib/account-type-resolver'; import { combineCmeSessions, currentTradeDateCT } from '@/lib/trading-logic'; export async function GET(_req: Request, { params }: { params: Promise<{ id: string }> }) { const { id } = await params; const accountId = Number(id); const clients = getClients(); for (const client of clients.values()) { const daily = client.dailyPnL?.[accountId]; if (daily !== undefined) { // Serve the same combined-day view the rest of the app computes // with, so a combining firm's holiday stretch shows as one row. const combine = getAccountConfig(accountId).accountType?.combineCmeHolidays === true; return NextResponse.json(combineCmeSessions(combine, daily, currentTradeDateCT(), 0).dailyPnL); } } return NextResponse.json([]); }