fix(ui): כלי הלשונית (arguments/precedents/missing) דרך fetch של ה-worker; דשבורד דרך status-index (legal-ai #1117)
All checks were successful
INV-INT9 issue.status write-ownership / int9-guard (pull_request) Successful in 6s
All checks were successful
INV-INT9 issue.status write-ownership / int9-guard (pull_request) Successful in 6s
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -194,6 +194,7 @@ export class LegalApi {
|
|||||||
export interface CaseStatusEntry {
|
export interface CaseStatusEntry {
|
||||||
case_number: string;
|
case_number: string;
|
||||||
status: string;
|
status: string;
|
||||||
|
updated_at?: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CaseSummary {
|
export interface CaseSummary {
|
||||||
|
|||||||
@@ -1391,7 +1391,7 @@ const plugin = definePlugin({
|
|||||||
if (!caseNumber) return null;
|
if (!caseNumber) return null;
|
||||||
const apiBase = await resolveApiBase(ctx, companyIdOf(params));
|
const apiBase = await resolveApiBase(ctx, companyIdOf(params));
|
||||||
try {
|
try {
|
||||||
const resp = await ctx.http.fetch(
|
const resp = await fetchLegalApi(
|
||||||
`${apiBase}/api/cases/${encodeURIComponent(caseNumber)}/legal-arguments`,
|
`${apiBase}/api/cases/${encodeURIComponent(caseNumber)}/legal-arguments`,
|
||||||
);
|
);
|
||||||
if (!resp.ok) {
|
if (!resp.ok) {
|
||||||
@@ -1428,7 +1428,7 @@ const plugin = definePlugin({
|
|||||||
if (!caseNumber) return [];
|
if (!caseNumber) return [];
|
||||||
const apiBase = await resolveApiBase(ctx, companyIdOf(params));
|
const apiBase = await resolveApiBase(ctx, companyIdOf(params));
|
||||||
try {
|
try {
|
||||||
const resp = await ctx.http.fetch(
|
const resp = await fetchLegalApi(
|
||||||
`${apiBase}/api/cases/${encodeURIComponent(caseNumber)}/precedents`,
|
`${apiBase}/api/cases/${encodeURIComponent(caseNumber)}/precedents`,
|
||||||
);
|
);
|
||||||
if (!resp.ok) {
|
if (!resp.ok) {
|
||||||
@@ -1467,7 +1467,7 @@ const plugin = definePlugin({
|
|||||||
const url = new URL(`${apiBase}/api/missing-precedents`);
|
const url = new URL(`${apiBase}/api/missing-precedents`);
|
||||||
url.searchParams.set("case_number", caseNumber);
|
url.searchParams.set("case_number", caseNumber);
|
||||||
url.searchParams.set("status", "open");
|
url.searchParams.set("status", "open");
|
||||||
const resp = await ctx.http.fetch(url.toString());
|
const resp = await fetchLegalApi(url.toString());
|
||||||
if (!resp.ok) {
|
if (!resp.ok) {
|
||||||
ctx.logger.warn("legal-case-missing-precedents: API error", {
|
ctx.logger.warn("legal-case-missing-precedents: API error", {
|
||||||
caseNumber,
|
caseNumber,
|
||||||
@@ -1488,13 +1488,13 @@ const plugin = definePlugin({
|
|||||||
|
|
||||||
ctx.data.register("legal-dashboard-stats", async () => {
|
ctx.data.register("legal-dashboard-stats", async () => {
|
||||||
try {
|
try {
|
||||||
const cases = await api.listCases();
|
const cases = await api.listCaseStatuses();
|
||||||
const byStatus: Record<string, number> = {};
|
const byStatus: Record<string, number> = {};
|
||||||
let weekActivity = 0;
|
let weekActivity = 0;
|
||||||
const weekAgoMs = Date.now() - 7 * 24 * 60 * 60 * 1000;
|
const weekAgoMs = Date.now() - 7 * 24 * 60 * 60 * 1000;
|
||||||
for (const c of cases) {
|
for (const c of cases) {
|
||||||
byStatus[c.status] = (byStatus[c.status] ?? 0) + 1;
|
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) {
|
if (updated) {
|
||||||
const t = Date.parse(updated);
|
const t = Date.parse(updated);
|
||||||
if (!Number.isNaN(t) && t >= weekAgoMs) weekActivity += 1;
|
if (!Number.isNaN(t) && t >= weekAgoMs) weekActivity += 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user