API 로그 미들웨어 개선: 그룹 ID 생성 로직
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# 논리적 데이터베이스 관계 문서
|
||||
|
||||
> **자동 생성**: 2025-12-15 13:50:25
|
||||
> **자동 생성**: 2025-12-15 16:04:28
|
||||
> **소스**: Eloquent 모델 관계 분석
|
||||
|
||||
## 📊 모델별 관계 현황
|
||||
|
||||
@@ -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