From edae56969f416199b4c735cd83d6596c4afb9619 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Thu, 14 May 2026 13:49:06 +0200 Subject: [PATCH] =?UTF-8?q?chore(insights):=20drop=20orphaned=20/api/insig?= =?UTF-8?q?hts/general-status=20=E2=80=94=20superseded=20by=20InsightAdvis?= =?UTF-8?q?orCard=20since=20v1.4.16?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The HTTP route had no remaining UI callers — the v1.4.16 polish replaced the on the /insights overview with the polished , and the per-metric sub-pages each consume their own dedicated endpoint (/api/insights/{weight,bmi,pulse,blood-pressure, medication-compliance}-status). The lib helper generateGeneralStatusForUser remains in src/lib/insights/general-status.ts because the reminder worker still pre-warms the daily cache for users opted in to the briefing notification (src/lib/jobs/reminder-worker.ts). Verification: - grep confirms zero callers under src/ outside the route file itself - the route was not registered in src/lib/openapi/routes.ts and docs/api/openapi.yaml carries no general-status path - pnpm typecheck remains clean --- src/app/api/insights/general-status/route.ts | 49 -------------------- 1 file changed, 49 deletions(-) delete mode 100644 src/app/api/insights/general-status/route.ts diff --git a/src/app/api/insights/general-status/route.ts b/src/app/api/insights/general-status/route.ts deleted file mode 100644 index 80585dfd4..000000000 --- a/src/app/api/insights/general-status/route.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { NextRequest } from "next/server"; -import { apiSuccess } from "@/lib/api-response"; -import { - generateGeneralStatusForUser, - resolveGeneralStatusLocale, -} from "@/lib/insights/general-status"; -import { apiHandler, requireAuth } from "@/lib/api-handler"; -import { annotate } from "@/lib/logging/context"; -import { resolveServerLocale } from "@/lib/i18n/server-locale"; - -export const dynamic = "force-dynamic"; - -/** - * @deprecated since v1.4.25 — the `/insights` page no longer mounts the - * `` that drove this endpoint; the polished - * `` block above the per-metric sections covers - * the same surface with severity-ordered recommendations + rationale. - * - * The route + underlying `generateGeneralStatusForUser` lib remain - * live because the reminder worker (`src/lib/jobs/reminder-worker.ts`) - * still pre-warms the daily general-status cache for users opted in to - * the briefing notification. Removing the route would break the - * warm-cache job's HTTP-style coverage tests; removing the lib would - * break the worker. Both stay; this comment is for new callers. - * - * New surfaces should consume `` via - * `useInsightsAdvisorQuery()` (`@/components/insights/use-insights-advisor`) - * instead of fetching this endpoint directly. - */ -export const GET = apiHandler(async (request: NextRequest) => { - const { user } = await requireAuth(); - - const localeParam = request.nextUrl.searchParams.get("locale"); - const resolved = await resolveServerLocale({ - request, - userLocale: user.locale ?? null, - override: localeParam, - }); - const locale = resolveGeneralStatusLocale(resolved); - - const result = await generateGeneralStatusForUser(user.id, { - locale, - force: false, - }); - - annotate({ action: { name: "insights.general-status" } }); - - return apiSuccess(result); -});