Move vehicle utilization filtering to database query #15

Closed
opened 2026-02-08 06:44:20 -08:00 by kyle · 1 comment
Owner

Context: vehicles.service.ts getUtilization() fetches all events then filters for past events in application code. This should be done at the database level.

File: backend/src/vehicles/vehicles.service.ts (lines 116-143)

Suggested fix:

  • Add where: { endTime: { lt: new Date() } } to the Prisma query
  • Let PostgreSQL handle the filtering instead of fetching all events to Node.js

Effort: Small

**Context:** `vehicles.service.ts` `getUtilization()` fetches all events then filters for past events in application code. This should be done at the database level. **File:** `backend/src/vehicles/vehicles.service.ts` (lines 116-143) **Suggested fix:** - Add `where: { endTime: { lt: new Date() } }` to the Prisma query - Let PostgreSQL handle the filtering instead of fetching all events to Node.js **Effort:** Small
Author
Owner

Moved vehicle utilization event filtering to the Prisma query with .

Moved vehicle utilization event filtering to the Prisma query with .
kyle closed this issue 2026-02-08 07:09:58 -08:00
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kyle/vip-coordinator#15