fix: 프로필 이미지 업로드 시 profile_photo_path 필드 직접 처리
- 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 <noreply@anthropic.com>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user