From bf5cfdcd50118a153e0847e6d0cff94b79ee061a Mon Sep 17 00:00:00 2001 From: marco370 <48531002-marco370@users.noreply.replit.com> Date: Thu, 23 Oct 2025 10:38:40 +0000 Subject: [PATCH] Show only guards with driver's licenses and update site filtering Modify the query to include guards with driver's licenses and use a left join for service types. Replit-Commit-Author: Agent Replit-Commit-Session-Id: e5565357-90e1-419f-b9a8-6ee8394636df Replit-Commit-Checkpoint-Type: intermediate_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/6d543d2c-20b9-4ea6-93fe-70fe9b1d9f80/e5565357-90e1-419f-b9a8-6ee8394636df/AXEqh9q --- server/routes.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/server/routes.ts b/server/routes.ts index 2569f80..cd7bf8c 100644 --- a/server/routes.ts +++ b/server/routes.ts @@ -3199,7 +3199,7 @@ export async function registerRoutes(app: Express): Promise { longitude: sites.longitude, }) .from(sites) - .innerJoin(serviceTypes, eq(sites.serviceTypeId, serviceTypes.id)) + .leftJoin(serviceTypes, eq(sites.serviceTypeId, serviceTypes.id)) .where( and( eq(sites.location, location as "roccapiemonte" | "milano" | "roma"), @@ -3235,17 +3235,18 @@ export async function registerRoutes(app: Express): Promise { return res.status(400).json({ message: "Invalid date format (use YYYY-MM-DD)" }); } - // Ottieni tutte le guardie per location + // Ottieni tutte le guardie per location CHE HANNO LA PATENTE const allGuards = await db .select() .from(guards) .where( and( eq(guards.location, location as "roccapiemonte" | "milano" | "roma"), - eq(guards.isActive, true) + eq(guards.isActive, true), + eq(guards.hasDriverLicense, true) ) ) - .orderBy(guards.lastName, guards.firstName); + .orderBy(guards.lastName); // Calcola settimana corrente per calcolare ore settimanali const [year, month, day] = date.split("-").map(Number);