mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 12:32:43 +00:00
chore(insights): drop orphaned /api/insights/general-status — superseded by InsightAdvisorCard since v1.4.16
The HTTP route had no remaining UI callers — the v1.4.16 polish replaced
the <InsightStatusCard> on the /insights overview with the polished
<InsightAdvisorCard>, 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
This commit is contained in:
1 parent
ef03705e51
commit
edae56969f
1 file changed
-49
@@ -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
|
|
||||||
* `<InsightStatusCard>` that drove this endpoint; the polished
|
|
||||||
* `<InsightAdvisorCard>` 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 `<InsightAdvisorCard>` 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);
|
|
||||||
});
|
|
||||||
Reference in new issue
Block a user