-
Notifications
You must be signed in to change notification settings - Fork 3
refactor : 유저 이미지 변경도 유저 정보 수정에 포함 #179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -52,21 +52,10 @@ public ResponseEntity<UserInfoResponse> getUserInfo(@AuthenticationPrincipal Aut | |
| @PutMapping("/users") | ||
| public ResponseEntity<UserInfoResponse> modifyUserInfo( | ||
| @AuthenticationPrincipal AuthUser authUser, | ||
| @RequestBody ModifyUserInfoRequest modifyUserInfoRequest | ||
| ){ | ||
| return ResponseEntity.status(HttpStatus.OK).body(userService.modifyUserInfo(authUser, modifyUserInfoRequest)); | ||
| } | ||
|
|
||
| //유저 프로필 이미지 등록 | ||
| @Operation( | ||
| summary = "프로필 이미지 등록", | ||
| description = "유저의 프로필 이미지를 등록합니다. 기존의 이미지가 있는 경우, 기존 이미지가 삭제되고 새로운 이미지로 교체됩니다.") | ||
| @PutMapping("/users/profile") | ||
| public ResponseEntity<UserProfileImageResponse> uploadUserProfileImage( | ||
| @AuthenticationPrincipal AuthUser authUser, | ||
| @RequestPart("request") ModifyUserInfoRequest request, | ||
| @RequestPart(value = "image", required = false) MultipartFile image | ||
| ){ | ||
| return ResponseEntity.status(HttpStatus.OK).body(userService.uploadUserProfileImage(authUser, image)); | ||
| return ResponseEntity.status(HttpStatus.OK).body(userService.modifyUserInfo(authUser, request, image)); | ||
| } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent ❓ Verification inconclusive컨텐츠 타입 매핑 명시 및 JSON/Multipart 동시 지원 제안 현재 시그니처는 멀티파트만 처리 가능하게 보입니다. 기존 클라이언트가 application/json으로 전송하면 415가 날 수 있습니다. 소비 타입을 명시하고, JSON 전용 오버로드를 추가하면 하위 호환을 유지할 수 있습니다. 멀티파트 메서드에 consumes를 명시: - @PutMapping("/users")
+ @PutMapping(value = "/users", consumes = org.springframework.http.MediaType.MULTIPART_FORM_DATA_VALUE)
public ResponseEntity<UserInfoResponse> modifyUserInfo(
@AuthenticationPrincipal AuthUser authUser,
- @RequestPart("request") ModifyUserInfoRequest request,
+ @Valid @RequestPart("request") ModifyUserInfoRequest request,
@RequestPart(value = "image", required = false) MultipartFile image
){
return ResponseEntity.status(HttpStatus.OK).body(userService.modifyUserInfo(authUser, request, image));
}JSON 전용 오버로드 추가(동일 경로, 다른 consumes): @PutMapping(value = "/users", consumes = org.springframework.http.MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<UserInfoResponse> modifyUserInfoJson(
@AuthenticationPrincipal AuthUser authUser,
@Valid @RequestBody ModifyUserInfoRequest request
) {
return ResponseEntity.status(HttpStatus.OK).body(userService.modifyUserInfo(authUser, request, null));
}구현 후 기존 프런트가 JSON 또는 멀티파트 모두 동작하는지 확인을 권장합니다. 다음 쿼리로 기존 @RequestBody ModifyUserInfoRequest 사용 흔적이 남아있는지 확인해 주세요. 🏁 Script executed: #!/bin/bash
rg -nP '@RequestBody\s+ModifyUserInfoRequest' --type=java -C2Length of output: 63 멀티파트 및 JSON 요청 동시 지원을 위한 아래와 같이 Multipart 전용 핸들러에
- @PutMapping("/users")
+ @PutMapping(
+ value = "/users",
+ consumes = org.springframework.http.MediaType.MULTIPART_FORM_DATA_VALUE
+ )
public ResponseEntity<UserInfoResponse> modifyUserInfo(
@AuthenticationPrincipal AuthUser authUser,
- @RequestPart("request") ModifyUserInfoRequest request,
+ @Valid @RequestPart("request") ModifyUserInfoRequest request,
@RequestPart(value = "image", required = false) MultipartFile image
) {
return ResponseEntity.status(HttpStatus.OK)
.body(userService.modifyUserInfo(authUser, request, image));
}@PutMapping(
value = "/users",
consumes = org.springframework.http.MediaType.APPLICATION_JSON_VALUE
)
public ResponseEntity<UserInfoResponse> modifyUserInfoJson(
@AuthenticationPrincipal AuthUser authUser,
@Valid @RequestBody ModifyUserInfoRequest request
) {
return ResponseEntity.status(HttpStatus.OK)
.body(userService.modifyUserInfo(authUser, request, null));
}구현 후 기존 프런트엔드에서 JSON 및 Multipart 요청 모두 정상 처리되는지 꼭 확인해 주세요. 🤖 Prompt for AI Agents
minjee2758 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| @Operation( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
S3 삭제 시 디렉터리 상수 사용 및 업로드-삭제 순서 개선 제안
다음과 같이 수정 제안 드립니다.
검증이 필요하시면, s3Uploader.delete의 시그니처와 디렉터리 인자를 다음 스크립트로 확인해 주세요.
🏁 Script executed:
Length of output: 2630
아래 스크립트로
S3Uploader.delete메서드 정의(시그니처)와 호출부를 확인해주세요.🏁 Script executed:
Length of output: 536
S3 삭제 리팩토링: 디렉터리 상수 사용 및 안전한 업로드-삭제 순서 적용
s3Uploader.delete(String fileUrl, String dirName)시그니처 확인됨."profile"대신S3Directory.PROFILE.getDir()사용으로 일관성 확보.검토 후 아래와 같이 반영해주세요.
📝 Committable suggestion
🤖 Prompt for AI Agents