Extract shared hard-delete authorization into reusable utility #9

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

Context: Hard-delete authorization logic is copy-pasted across 4 services (vips, drivers, vehicles, events) with identical patterns. Additionally, query string boolean parsing (hard === 'true') is duplicated in 5+ controllers.

Files affected:

  • backend/src/vips/vips.service.ts (lines 61-80)
  • backend/src/drivers/drivers.service.ts (lines 81-100)
  • backend/src/vehicles/vehicles.service.ts (lines 92-111)
  • backend/src/events/events.service.ts (lines 252-271)
  • 5+ controllers with hard === 'true' parsing

Suggested fix:

  • Create a BaseService class or shared utility with hardDeleteWithAuth(model, id, user) method
  • Or create a @HardDelete() decorator/pipe for controllers
  • Use a ParseBoolPipe or shared transform for query string booleans

Effort: Small-Medium

**Context:** Hard-delete authorization logic is copy-pasted across 4 services (vips, drivers, vehicles, events) with identical patterns. Additionally, query string boolean parsing (`hard === 'true'`) is duplicated in 5+ controllers. **Files affected:** - `backend/src/vips/vips.service.ts` (lines 61-80) - `backend/src/drivers/drivers.service.ts` (lines 81-100) - `backend/src/vehicles/vehicles.service.ts` (lines 92-111) - `backend/src/events/events.service.ts` (lines 252-271) - 5+ controllers with `hard === 'true'` parsing **Suggested fix:** - Create a `BaseService` class or shared utility with `hardDeleteWithAuth(model, id, user)` method - Or create a `@HardDelete()` decorator/pipe for controllers - Use a `ParseBoolPipe` or shared transform for query string booleans **Effort:** Small-Medium
Author
Owner

Implemented shared hard-delete utility in and in . Updated all 4 services and controllers.

Implemented shared hard-delete utility in and in . Updated all 4 services and controllers.
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#9