From 2442fd1d1515ea26aaaea339ca3417417a685d8c Mon Sep 17 00:00:00 2001 From: hskwon Date: Mon, 15 Dec 2025 22:11:22 +0900 Subject: [PATCH] =?UTF-8?q?API=20=EB=A1=9C=EA=B7=B8=20=EB=AF=B8=EB=93=A4?= =?UTF-8?q?=EC=9B=A8=EC=96=B4=20=EA=B0=9C=EC=84=A0:=20=EA=B7=B8=EB=A3=B9?= =?UTF-8?q?=20ID=20=EC=83=9D=EC=84=B1=20=EB=A1=9C=EC=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LOGICAL_RELATIONSHIPS.md | 2 +- app/Http/Middleware/LogApiRequest.php | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/LOGICAL_RELATIONSHIPS.md b/LOGICAL_RELATIONSHIPS.md index 0a1cf46..f870cfd 100644 --- a/LOGICAL_RELATIONSHIPS.md +++ b/LOGICAL_RELATIONSHIPS.md @@ -1,6 +1,6 @@ # 논리적 데이터베이스 관계 문서 -> **자동 생성**: 2025-12-15 13:50:25 +> **자동 생성**: 2025-12-15 16:04:28 > **소스**: Eloquent 모델 관계 분석 ## 📊 모델별 관계 현황 diff --git a/app/Http/Middleware/LogApiRequest.php b/app/Http/Middleware/LogApiRequest.php index 93a2c0e..ab4841b 100644 --- a/app/Http/Middleware/LogApiRequest.php +++ b/app/Http/Middleware/LogApiRequest.php @@ -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);