Cache driver lookup in /me controller routes #20
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context: The drivers controller has multiple
/me/*routes that each independently callfindByUserId()to resolve the current driver. When a driver hits several of these endpoints, the same lookup runs repeatedly.File:
backend/src/drivers/drivers.controller.ts(lines 44-49, 58-75, 83-100, 112-131)Suggested fix:
@CurrentDriver()param decorator (similar to@CurrentUser()) that resolves the driver once per request via middleware or interceptorfindByUserId()result is reused within the same request lifecycleEffort: Small
Created decorator and . Updated drivers controller /me routes to use single lookup.