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);