-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/#75 유저 프로필 사진, 학적 정보 변경 기능 구현 #76
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
Merged
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
123fd05
feat: 유저 프로필 이미지 변경 기능 구현
1winhyun 23f7e53
feat: 유저 학적 정보 변경 기능 구현
1winhyun d20adaa
refactor: 프로필 이미지 변경 앤드포인트 수정
1winhyun 41a608d
refactor: UserMapper null 처리 수정
1winhyun ebfdcf0
refactor: 학적정보 수정 3개월에 한번 가능으로 수정
1winhyun e96e15f
refactor: 사용자 학적 정보 수정 앤드포인트 수정
1winhyun File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
...java/com/campus/campus/domain/user/application/dto/request/ChangeProfileImageRequest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| package com.campus.campus.domain.user.application.dto.request; | ||
|
|
||
| import io.swagger.v3.oas.annotations.media.Schema; | ||
|
|
||
| public record ChangeProfileImageRequest( | ||
| @Schema(description = "새로운 사용자 프로필 이미지", example = "http://image/img_640x640.jpg") | ||
| String newProfileImage | ||
| ) { | ||
| } |
15 changes: 15 additions & 0 deletions
15
...java/com/campus/campus/domain/user/application/dto/request/ChangeUserAcademicRequest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| package com.campus.campus.domain.user.application.dto.request; | ||
|
|
||
| import io.swagger.v3.oas.annotations.media.Schema; | ||
| import jakarta.validation.constraints.NotNull; | ||
|
|
||
| public record ChangeUserAcademicRequest( | ||
| @Schema(description = "변경할 학교 ID", example = "1") | ||
| @NotNull | ||
| Long schoolId, | ||
|
|
||
| @Schema(description = "변경할 학과 ID", example = "15") | ||
| @NotNull | ||
| Long majorId | ||
| ) { | ||
| } |
15 changes: 15 additions & 0 deletions
15
...va/com/campus/campus/domain/user/application/dto/response/ChangeProfileImageResponse.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| package com.campus.campus.domain.user.application.dto.response; | ||
|
|
||
| import io.swagger.v3.oas.annotations.media.Schema; | ||
|
|
||
| public record ChangeProfileImageResponse( | ||
| @Schema(description = "유저 id", example = "1") | ||
| Long userId, | ||
|
|
||
| @Schema(description = "유저 닉네임(campusNickname 설정했으면 campusNickname, 아니면, nickname") | ||
| String nickname, | ||
|
|
||
| @Schema(description = "새로운 사용자 프로필 이미지", example = "http://image/img_640x640.jpg") | ||
| String newProfileImage | ||
| ) { | ||
| } |
26 changes: 26 additions & 0 deletions
26
...va/com/campus/campus/domain/user/application/dto/response/ChangeUserAcademicResponse.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| package com.campus.campus.domain.user.application.dto.response; | ||
|
|
||
| import java.time.LocalDateTime; | ||
|
|
||
| import io.swagger.v3.oas.annotations.media.Schema; | ||
|
|
||
| public record ChangeUserAcademicResponse( | ||
| @Schema(description = "유저 id", example = "1") | ||
| Long userId, | ||
|
|
||
| @Schema(description = "유저 닉네임(campusNickname 설정했으면 campusNickname, 아니면, nickname") | ||
| String nickname, | ||
|
|
||
| @Schema(description = "변경된 학교 이름", example = "가천대학교") | ||
| String schoolName, | ||
|
|
||
| @Schema(description = "변경된 단과대 이름", example = "IT융합대학") | ||
| String collegeName, | ||
|
|
||
| @Schema(description = "변경된 학과 이름", example = "소프트웨어학과") | ||
| String majorName, | ||
|
|
||
| @Schema(description = "다음 변경 가능 날짜", example = "2026-07-15T12:00:00") | ||
| LocalDateTime nextUpdateAvailableDate | ||
| ) { | ||
| } |
9 changes: 9 additions & 0 deletions
9
...mpus/campus/domain/user/application/exception/AcademicInfoUpdateRestrictionException.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| package com.campus.campus.domain.user.application.exception; | ||
|
|
||
| import com.campus.campus.global.common.exception.ApplicationException; | ||
|
|
||
| public class AcademicInfoUpdateRestrictionException extends ApplicationException { | ||
| public AcademicInfoUpdateRestrictionException() { | ||
| super(ErrorCode.ACADEMIC_INFO_CANNOT_CHANGE); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,7 +7,11 @@ | |
| import org.springframework.web.bind.annotation.RestController; | ||
|
|
||
| import com.campus.campus.domain.user.application.dto.request.CampusNicknameUpdateRequest; | ||
| import com.campus.campus.domain.user.application.dto.request.ChangeProfileImageRequest; | ||
| import com.campus.campus.domain.user.application.dto.request.ChangeUserAcademicRequest; | ||
| import com.campus.campus.domain.user.application.dto.request.UserProfileRequest; | ||
| import com.campus.campus.domain.user.application.dto.response.ChangeProfileImageResponse; | ||
| import com.campus.campus.domain.user.application.dto.response.ChangeUserAcademicResponse; | ||
| import com.campus.campus.domain.user.application.dto.response.UserFirstProfileResponse; | ||
| import com.campus.campus.domain.user.application.dto.response.UserInfoResponse; | ||
| import com.campus.campus.domain.user.application.service.UserService; | ||
|
|
@@ -42,6 +46,25 @@ public CommonResponse<Void> updateCampusNickname(@CurrentUserId Long userId, | |
| return CommonResponse.success(UserResponseCode.NICKNAME_UPDATE_SUCCESS); | ||
| } | ||
|
|
||
|
|
||
| @PatchMapping("/change/profile-image/") | ||
| @Operation(summary = "사용자 프로필 이미지 변경") | ||
| public CommonResponse<ChangeProfileImageResponse> updateProfileImage(@CurrentUserId Long userId, | ||
| @RequestBody @Valid ChangeProfileImageRequest changeProfileImageRequest) { | ||
| ChangeProfileImageResponse response = userService.updateProfileImage(userId, changeProfileImageRequest); | ||
|
|
||
| return CommonResponse.success(UserResponseCode.PROFILE_IMAGE_UPDATE_SUCCESS, response); | ||
| } | ||
|
||
|
|
||
| @PatchMapping("/profile/academic") | ||
| @Operation(summary = "사용자 학적 정보 수정 (6개월 1회 제한)") | ||
| public CommonResponse<ChangeUserAcademicResponse> updateAcademicInfo(@CurrentUserId Long userId, | ||
| @RequestBody @Valid ChangeUserAcademicRequest changeUserAcademicRequest) { | ||
| ChangeUserAcademicResponse response = userService.updateUserAcademic(userId, changeUserAcademicRequest); | ||
|
|
||
| return CommonResponse.success(UserResponseCode.ACADEMIC_INFO_UPDATE_SUCCESS, response); | ||
| } | ||
|
|
||
| @GetMapping | ||
| @Operation(summary = "사용자 정보 조회(홈 화면)") | ||
| public CommonResponse<UserInfoResponse> getUserInfo(@CurrentUserId Long userId) { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
campusNicknamenull 처리가 다른 매퍼 메서드들과 일관성이 없습니다.toUserInfoResponse(Line 36)와toChangeProfileImageResponse(Line 46)에서는campusNickname이 null일 경우nickname으로 대체하는 로직이 있지만,toChangeUserAcademicResponse에서는campusNickname을 직접 사용합니다. 동일한 패턴을 적용해야 합니다.또한, Line 56에서
user.getMajor().getCollege().getCollegeName()대신user.getCollege().getCollegeName()을 사용하는 것이 더 직관적이고 일관성 있습니다.🔧 수정 제안
public ChangeUserAcademicResponse toChangeUserAcademicResponse(User user) { return new ChangeUserAcademicResponse( user.getId(), - user.getCampusNickname(), + user.getCampusNickname() == null ? user.getNickname() : user.getCampusNickname(), user.getSchool().getSchoolName(), - user.getMajor().getCollege().getCollegeName(), + user.getCollege().getCollegeName(), user.getMajor().getMajorName(), user.getLastProfileUpdatedAt() ); }🤖 Prompt for AI Agents