feat: caller cache invalidation endpoint + worklist auth fix

- POST /api/caller/invalidate — clears Redis cache for a phone number
- WorklistController: resolves agent name from login cache (avoids currentUser query)
- AuthController: caches agent name in Redis during login (keyed by token suffix)
- WorklistModule: imports AuthModule (forwardRef for circular dep)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-02 12:14:56 +05:30
parent d0df6618b5
commit 1d1f27607f
4 changed files with 27 additions and 2 deletions

View File

@@ -166,6 +166,12 @@ export class AuthController {
}
}
// Cache agent name for worklist resolution (avoids re-querying currentUser with user JWT)
const agentFullName = `${workspaceMember?.name?.firstName ?? ''} ${workspaceMember?.name?.lastName ?? ''}`.trim();
if (agentFullName) {
await this.sessionService.setCache(`agent:name:${accessToken.slice(-16)}`, agentFullName, 86400);
}
return {
accessToken,
refreshToken: tokens.refreshToken.token,