fix(04-06): five post-deploy fixes

- Middleware (proxy.ts): switch internal API calls to localhost instead of
  request.url — avoids Docker hairpin NAT issues where the container can't
  reach its own external hostname via Traefik
- ProjectRow timer: pass projectId={project.id} to TimerCell so it calls
  startTimer(projectId) directly instead of startTimerForClient(project.id)
- Admin client list: add slug field to ClientWithPayments + show slug link
  when available (falls back to token) — so admins see the human-readable URL
- Analytics contracted: sum projects.accepted_total (authoritative) instead
  of clients.accepted_total (always 0 in multi-project architecture)
- createClient: auto-generate slug from client name at creation time
  (e.g. "Mario Rossi" → "mario-rossi"), with -2/-3 suffix on conflict

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-22 13:42:38 +02:00
parent e6a9774cfe
commit eab88c9f63
6 changed files with 42 additions and 14 deletions
+3
View File
@@ -35,6 +35,7 @@ export type ClientWithPayments = {
name: string;
brand_name: string;
token: string;
slug: string | null;
accepted_total: string;
archived: boolean;
created_at: Date;
@@ -84,6 +85,7 @@ export async function getAllClientsWithPayments(
name: c.name,
brand_name: c.brand_name,
token: c.token,
slug: c.slug ?? null,
accepted_total: c.accepted_total ?? "0",
archived: c.archived ?? false,
created_at: c.created_at,
@@ -156,6 +158,7 @@ export async function getAllClientsWithPayments(
name: c.name,
brand_name: c.brand_name,
token: c.token,
slug: c.slug ?? null,
accepted_total: c.accepted_total ?? "0",
archived: c.archived ?? false,
created_at: c.created_at,