import { NextResponse } from "next/server"; import { fetchGanttApi } from "@/lib/data/gantt-api"; interface ActivityPayload { tasks?: unknown[]; projects?: unknown[]; } export async function GET() { try { const payload = await fetchGanttApi("/tasks?scope=all"); return NextResponse.json( { tasks: Array.isArray(payload.tasks) ? payload.tasks : [], projects: Array.isArray(payload.projects) ? payload.projects : [], }, { headers: { "Cache-Control": "no-store", }, } ); } catch (error) { const message = error instanceof Error ? error.message : "Failed to fetch activity data"; console.error("[api/activity] Request failed", error); return NextResponse.json({ error: message }, { status: 500 }); } }