From 49578ab442bbc05d58eb30fb2276567a16c63bac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=98=D0=BB=D1=8C=D1=8F=D1=81=20=D0=A1=D1=83=D0=BB=D1=82?= =?UTF-8?q?=D0=B0=D0=BD=D0=BE=D0=B2?= Date: Sun, 6 Sep 2026 19:58:24 +0300 Subject: [PATCH] =?UTF-8?q?DI2=20=D1=84=D0=B8=D0=BA=D1=81=20=D0=BA=D0=BE?= =?UTF-8?q?=D0=BB=D0=BB=D0=B8=D0=B7=D0=B8=D0=B8:=20=D0=B4=D0=B0=D1=88?= =?UTF-8?q?=D0=B1=D0=BE=D1=80=D0=B4=20DI2=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B8?= =?UTF-8?q?=D0=BC=D0=B5=D0=BD=D0=BE=D0=B2=D0=B0=D0=BD=20=D0=B2=20/api/di2/?= =?UTF-8?q?dashboard?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit DI2-роутер регистрируется перед основным dashboard.routes.ts и перехватывал GET /api/dashboard (403 без finance.manage и неверный JSON — live-регрессия главного дашборда CRM). Роут переименован, в DI2_PREFIXES /api/dashboard заменён на /api/di2, клиент client-di2 ходит на новый путь (fetch + queryKey + prefetch в app-sidebar). Форматы старого модуля финансов не тронуты. --- client-di2/src/components/app-sidebar.tsx | 2 +- client-di2/src/pages/dashboard.tsx | 2 +- server/finance-di2/index.ts | 2 +- server/finance-di2/routes.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client-di2/src/components/app-sidebar.tsx b/client-di2/src/components/app-sidebar.tsx index 4d9c643..4f26b8b 100644 --- a/client-di2/src/components/app-sidebar.tsx +++ b/client-di2/src/components/app-sidebar.tsx @@ -50,7 +50,7 @@ export function AppSidebar() { - prefetch(["/api/dashboard"])}> + prefetch(["/api/di2/dashboard"])}> Дашборд diff --git a/client-di2/src/pages/dashboard.tsx b/client-di2/src/pages/dashboard.tsx index c82de34..a9cb7ef 100644 --- a/client-di2/src/pages/dashboard.tsx +++ b/client-di2/src/pages/dashboard.tsx @@ -130,7 +130,7 @@ export default function Dashboard() { const qs = queryParams.toString(); const { data, isLoading, error } = useQuery({ - queryKey: ["/api/dashboard", qs], + queryKey: ["/api/di2/dashboard", qs], queryFn: async () => { const resp = await fetch(`/api/dashboard${qs ? `?${qs}` : ""}`); if (!resp.ok) throw new Error("fetch error"); diff --git a/server/finance-di2/index.ts b/server/finance-di2/index.ts index 699e15c..17e9fb3 100644 --- a/server/finance-di2/index.ts +++ b/server/finance-di2/index.ts @@ -12,7 +12,7 @@ const DI2_PREFIXES = [ "/api/expenses", "/api/expense-categories", "/api/debt", - "/api/dashboard", + "/api/di2", "/api/profitability", "/api/heatmap", "/api/planning", diff --git a/server/finance-di2/routes.ts b/server/finance-di2/routes.ts index f5fb00a..e749ecf 100644 --- a/server/finance-di2/routes.ts +++ b/server/finance-di2/routes.ts @@ -1498,7 +1498,7 @@ export async function registerRoutes(httpServer: Server, app: Express): Promise< return [`(${parts.join(" OR ")})`]; } - app.get("/api/dashboard", async (req, res) => { + app.get("/api/di2/dashboard", async (req, res) => { try { const cacheKey = stableKey("dashboard", req.query as Record); const result = await cachedQuery(cacheKey, TTL_LONG, async () => {