From abf4d09f1b4b40a9dbb16ba64c14aa2e3cce160c Mon Sep 17 00:00:00 2001 From: kent Date: Mon, 29 Dec 2025 21:04:32 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=ED=94=84=EB=A1=9C=ED=95=84=20=EC=9D=B4?= =?UTF-8?q?=EB=AF=B8=EC=A7=80=20=EC=97=85=EB=A1=9C=EB=93=9C=20=EC=8B=9C=20?= =?UTF-8?q?profile=5Fphoto=5Fpath=20=ED=95=84=EB=93=9C=20=EC=A7=81?= =?UTF-8?q?=EC=A0=91=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - updateMe() 메서드에서 profile_photo_path, display_name 고정 필드를 effectiveFieldMap() 동적 필드 처리 전에 직접 저장하도록 수정 - 기존 로직은 SettingFieldDef 테이블 기반 동적 필드만 처리하여 profile_photo_path가 무시되던 문제 해결 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- app/Services/TenantUserProfileService.php | 36 +++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/app/Services/TenantUserProfileService.php b/app/Services/TenantUserProfileService.php index 3c2025c..47a3f1e 100644 --- a/app/Services/TenantUserProfileService.php +++ b/app/Services/TenantUserProfileService.php @@ -179,7 +179,8 @@ public static function me(array $params = []) /** * [PATCH] 내 프로필 수정 - * - enabled 필드만 반영 (관리자 수정과 동일 로직) + * - 고정 필드(profile_photo_path, display_name)는 직접 처리 + * - 동적 필드(enabled 필드)는 기존 update 로직으로 처리 */ public static function updateMe(array $params = []) { @@ -192,6 +193,37 @@ public static function updateMe(array $params = []) return ['error' => '인증 정보가 없습니다.', 'code' => 401]; } - return self::update($userId, $params); + // 고정 필드 추출 (동적 필드 처리 전에 직접 저장) + $fixedFields = ['profile_photo_path', 'display_name']; + $fixedData = []; + foreach ($fixedFields as $field) { + if (array_key_exists($field, $params)) { + $fixedData[$field] = $params[$field]; + unset($params[$field]); + } + } + + // 고정 필드가 있으면 직접 업데이트 + if (! empty($fixedData)) { + $profile = TenantUserProfile::firstOrCreate([ + 'tenant_id' => $tenantId, + 'user_id' => $userId, + ]); + $profile->fill($fixedData); + $profile->save(); + } + + // 동적 필드가 남아있으면 기존 로직으로 처리 + if (! empty($params)) { + return self::update($userId, $params); + } + + // 고정 필드만 있었으면 새로고침된 프로필 반환 + $fresh = TenantUserProfile::where('tenant_id', $tenantId) + ->where('user_id', $userId) + ->with(['user:id,name,email']) + ->first(); + + return $fresh ? $fresh->toArray() : null; } }