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
This commit is contained in:
parent
392079d2a1
commit
bf5cfdcd50
@ -3199,7 +3199,7 @@ export async function registerRoutes(app: Express): Promise<Server> {
|
|||||||
longitude: sites.longitude,
|
longitude: sites.longitude,
|
||||||
})
|
})
|
||||||
.from(sites)
|
.from(sites)
|
||||||
.innerJoin(serviceTypes, eq(sites.serviceTypeId, serviceTypes.id))
|
.leftJoin(serviceTypes, eq(sites.serviceTypeId, serviceTypes.id))
|
||||||
.where(
|
.where(
|
||||||
and(
|
and(
|
||||||
eq(sites.location, location as "roccapiemonte" | "milano" | "roma"),
|
eq(sites.location, location as "roccapiemonte" | "milano" | "roma"),
|
||||||
@ -3235,17 +3235,18 @@ export async function registerRoutes(app: Express): Promise<Server> {
|
|||||||
return res.status(400).json({ message: "Invalid date format (use YYYY-MM-DD)" });
|
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
|
const allGuards = await db
|
||||||
.select()
|
.select()
|
||||||
.from(guards)
|
.from(guards)
|
||||||
.where(
|
.where(
|
||||||
and(
|
and(
|
||||||
eq(guards.location, location as "roccapiemonte" | "milano" | "roma"),
|
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
|
// Calcola settimana corrente per calcolare ore settimanali
|
||||||
const [year, month, day] = date.split("-").map(Number);
|
const [year, month, day] = date.split("-").map(Number);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user