Extract shared Prisma include constants per entity #11

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

Context: Identical Prisma include objects (with the same nested relations) are duplicated 3-5 times per service file.

Files affected:

  • backend/src/drivers/drivers.service.ts - same include in findAll, findOne, findByUserId (lines 23-29, 40-44, 58-64)
  • backend/src/vehicles/vehicles.service.ts - same include repeated 3 times (lines 29-35, 57-63, 84-88)
  • backend/src/events/events.service.ts - 9-line include pattern duplicated 5 times (lines 72-82, 91-100, 111-120, 210-220, 236-246)

Suggested fix:

  • Define const EVENT_INCLUDE = { vip: true, driver: true, ... } as const at the top of each service
  • Reference the constant in all queries

Effort: Trivial

**Context:** Identical Prisma `include` objects (with the same nested relations) are duplicated 3-5 times per service file. **Files affected:** - `backend/src/drivers/drivers.service.ts` - same include in `findAll`, `findOne`, `findByUserId` (lines 23-29, 40-44, 58-64) - `backend/src/vehicles/vehicles.service.ts` - same include repeated 3 times (lines 29-35, 57-63, 84-88) - `backend/src/events/events.service.ts` - 9-line include pattern duplicated 5 times (lines 72-82, 91-100, 111-120, 210-220, 236-246) **Suggested fix:** - Define `const EVENT_INCLUDE = { vip: true, driver: true, ... } as const` at the top of each service - Reference the constant in all queries **Effort:** Trivial
Author
Owner

Extracted shared Prisma include constants in drivers, vehicles, and events services. Each service now defines the include pattern once at the top.

Extracted shared Prisma include constants in drivers, vehicles, and events services. Each service now defines the include pattern once at the top.
kyle closed this issue 2026-02-08 07:09:57 -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#11