API 로그 미들웨어 개선: 그룹 ID 생성 로직
This commit is contained in:
@@ -78,10 +78,9 @@ protected function logRequest(Request $request, Response $response, float $start
|
||||
$durationMs = (int) ((microtime(true) - $startTime) * 1000);
|
||||
|
||||
// 사용자/테넌트 정보 가져오기 (ApiKeyMiddleware에서 설정된 값 우선)
|
||||
$apiUser = app()->bound('api_user') ? app('api_user') : null;
|
||||
$tenantId = app()->bound('tenant_id') ? app('tenant_id') : null;
|
||||
$userId = $apiUser?->id ?? $request->user()?->id;
|
||||
$tenantId = $tenantId ?? $request->user()?->current_tenant_id;
|
||||
// api_user는 이미 user_id 값, tenant_id도 마찬가지
|
||||
$userId = app()->bound('api_user') ? app('api_user') : $request->user()?->id;
|
||||
$tenantId = app()->bound('tenant_id') ? app('tenant_id') : $request->user()?->current_tenant_id;
|
||||
|
||||
// 그룹 ID 생성 (동일 tenant+user의 연속 요청 묶기)
|
||||
$groupId = $this->getOrCreateGroupId($tenantId, $userId);
|
||||
|
||||
Reference in New Issue
Block a user