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:
@@ -4,8 +4,9 @@ import { sql, and, eq, inArray } from "drizzle-orm";
|
||||
|
||||
export async function getAnalyticsByYear(year: number) {
|
||||
const [contracted] = await db
|
||||
.select({ total: sql<string>`coalesce(sum(${clients.accepted_total}::numeric), 0)` })
|
||||
.from(clients)
|
||||
.select({ total: sql<string>`coalesce(sum(${projects.accepted_total}::numeric), 0)` })
|
||||
.from(projects)
|
||||
.innerJoin(clients, eq(projects.client_id, clients.id))
|
||||
.where(sql`extract(year from ${clients.created_at}) = ${year}`);
|
||||
|
||||
const [clientsRow] = await db
|
||||
|
||||
Reference in New Issue
Block a user