55import com .memesphere .domain .image .service .ImageService ;
66import com .memesphere .domain .image .service .ProfileService ;
77import com .memesphere .global .apipayload .ApiResponse ;
8+ import com .memesphere .global .jwt .CustomUserDetails ;
89import io .swagger .v3 .oas .annotations .Operation ;
910import lombok .RequiredArgsConstructor ;
1011import org .springframework .http .MediaType ;
12+ import org .springframework .security .core .annotation .AuthenticationPrincipal ;
1113import org .springframework .web .bind .annotation .*;
1214
1315@ RequestMapping ("/image" )
@@ -33,14 +35,14 @@ public ApiResponse<PresignedUrlResponse> uploadFile(@RequestBody ImageExtensionR
3335 return ApiResponse .onSuccess (url );
3436 }
3537
36- //프로필 이미지 조회 Api
37- @ GetMapping ("/profile/{user_id} " )
38+ // 프로필 이미지 조회 Api
39+ @ GetMapping ("/profile" )
3840 @ Operation (summary = "프로필 이미지 조회 API" ,
39- description = "회원가입한 유저의 프로필 이미지를 반환합니다." )
40- public ApiResponse <String > getProfile (@ PathVariable ("user_id" ) Long user_id ) {
41- String profileImage = profileService .getProfileImage (user_id );
41+ description = "현재 로그인한 유저의 프로필 이미지를 반환합니다." )
42+ public ApiResponse <String > getProfile (@ AuthenticationPrincipal CustomUserDetails customUserDetails ) {
43+ // 현재 로그인한 유저 정보에서 프로필 이미지 가져오기
44+ String profileImage = profileService .getProfileImage (customUserDetails );
4245
43- // null이거나 ""이면 result를 null로 반환
4446 return ApiResponse .onSuccess ((profileImage == null || profileImage .isEmpty ()) ? "null" : profileImage );
4547 }
4648
0 commit comments