From 75aa931f85fff9bfbdf01432f299cd0459579b10 Mon Sep 17 00:00:00 2001 From: Chaim Marcus Date: Sat, 24 Oct 2026 20:24:03 +0300 Subject: [PATCH] =?UTF-8?q?fix(ui):=20=D7=9B=D7=9C=D7=99=20=D7=94=D7=9C?= =?UTF-8?q?=D7=A9=D7=95=D7=A0=D7=99=D7=AA=20(arguments/precedents/missing)?= =?UTF-8?q?=20=D7=93=D7=A8=D7=9A=20fetch=20=D7=A9=D7=9C=20=D7=94-worker;?= =?UTF-8?q?=20=D7=93=D7=A9=D7=91=D7=95=D7=A8=D7=93=20=D7=93=D7=A8=D7=9A=20?= =?UTF-8?q?status-index=20(legal-ai=20#1117)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 5.5 --- src/legal-api.ts | 1 + src/worker.ts | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/legal-api.ts b/src/legal-api.ts index 5a72dfb..702ee69 100644 --- a/src/legal-api.ts +++ b/src/legal-api.ts @@ -194,6 +194,7 @@ export class LegalApi { export interface CaseStatusEntry { case_number: string; status: string; + updated_at?: string | null; } export interface CaseSummary { diff --git a/src/worker.ts b/src/worker.ts index f732762..38d426c 100644 --- a/src/worker.ts +++ b/src/worker.ts @@ -1391,7 +1391,7 @@ const plugin = definePlugin({ if (!caseNumber) return null; const apiBase = await resolveApiBase(ctx, companyIdOf(params)); try { - const resp = await ctx.http.fetch( + const resp = await fetchLegalApi( `${apiBase}/api/cases/${encodeURIComponent(caseNumber)}/legal-arguments`, ); if (!resp.ok) { @@ -1428,7 +1428,7 @@ const plugin = definePlugin({ if (!caseNumber) return []; const apiBase = await resolveApiBase(ctx, companyIdOf(params)); try { - const resp = await ctx.http.fetch( + const resp = await fetchLegalApi( `${apiBase}/api/cases/${encodeURIComponent(caseNumber)}/precedents`, ); if (!resp.ok) { @@ -1467,7 +1467,7 @@ const plugin = definePlugin({ const url = new URL(`${apiBase}/api/missing-precedents`); url.searchParams.set("case_number", caseNumber); url.searchParams.set("status", "open"); - const resp = await ctx.http.fetch(url.toString()); + const resp = await fetchLegalApi(url.toString()); if (!resp.ok) { ctx.logger.warn("legal-case-missing-precedents: API error", { caseNumber, @@ -1488,13 +1488,13 @@ const plugin = definePlugin({ ctx.data.register("legal-dashboard-stats", async () => { try { - const cases = await api.listCases(); + const cases = await api.listCaseStatuses(); const byStatus: Record = {}; let weekActivity = 0; const weekAgoMs = Date.now() - 7 * 24 * 60 * 60 * 1000; for (const c of cases) { byStatus[c.status] = (byStatus[c.status] ?? 0) + 1; - const updated = (c as { updated_at?: string | null }).updated_at; + const updated = c.updated_at; if (updated) { const t = Date.parse(updated); if (!Number.isNaN(t) && t >= weekAgoMs) weekActivity += 1;