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
+2 -2
View File
@@ -53,12 +53,12 @@ export function ClientRow({ client }: { client: ClientWithPayments }) {
</td>
<td className="py-3 px-4">
<a
href={`/client/${client.token}`}
href={`/client/${client.slug || client.token}`}
target="_blank"
rel="noopener noreferrer"
className="text-xs text-[#1A463C] hover:underline font-mono"
>
/client/{client.token.slice(0, 8)}
/client/{(client.slug || client.token).slice(0, 12)}
</a>
</td>
</tr>
+1
View File
@@ -52,6 +52,7 @@ export function ProjectRow({ project }: { project: ProjectWithPayments }) {
<td className="py-3 px-4">
<TimerCell
clientId={project.id}
projectId={project.id}
activeEntryId={project.activeTimerEntryId}
activeStartedAt={project.activeTimerStartedAt}
totalTrackedSeconds={project.totalTrackedSeconds}