-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
ํ์ ์ ๋ณด ์์ ๊ธฐ๋ฅ ์ธ๋ถํ
- Loading branch information
Showing
6 changed files
with
80 additions
and
88 deletions.
There are no files selected for viewing
This file contains 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
8 changes: 4 additions & 4 deletions
8
src/main/java/jungle/HandTris/application/service/MemberProfileService.java
This file contains 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 |
---|---|---|
@@ -1,14 +1,14 @@ | ||
package jungle.HandTris.application.service; | ||
|
||
import jakarta.servlet.http.HttpServletRequest; | ||
import jungle.HandTris.presentation.dto.request.MemberUpdateReq; | ||
import jungle.HandTris.presentation.dto.response.MemberProfileUpdateDetailsRes; | ||
import jungle.HandTris.presentation.dto.response.MemberRecordDetailRes; | ||
import jungle.HandTris.presentation.dto.response.ReissueTokenRes; | ||
import org.springframework.data.util.Pair; | ||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
public interface MemberProfileService { | ||
Pair<String, MemberRecordDetailRes> getMemberProfileWithStatsByNickname(String nickname); | ||
|
||
MemberProfileUpdateDetailsRes updateMemberProfile(HttpServletRequest request, MemberUpdateReq memberUpdateReq, MultipartFile profileImage, Boolean deleteProfileImage); | ||
ReissueTokenRes changeMemberNickname(String nickname, MemberUpdateReq memberUpdateReq); | ||
void changeMemberProfileImage(String nickname, MultipartFile profileImage); | ||
void deleteMemberProfileImage(String nickname); | ||
} |
This file contains 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
42 changes: 21 additions & 21 deletions
42
src/main/java/jungle/HandTris/presentation/MemberProfileController.java
This file contains 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 |
---|---|---|
@@ -1,43 +1,43 @@ | ||
package jungle.HandTris.presentation; | ||
|
||
import jakarta.servlet.http.HttpServletRequest; | ||
import jakarta.validation.Valid; | ||
import jungle.HandTris.application.service.MemberProfileService; | ||
import jungle.HandTris.application.service.MemberRecordService; | ||
import jungle.HandTris.domain.MemberRecord; | ||
import jungle.HandTris.global.dto.ResponseEnvelope; | ||
import jungle.HandTris.global.validation.UserNicknameFromJwt; | ||
import jungle.HandTris.presentation.dto.request.MemberUpdateReq; | ||
import jungle.HandTris.presentation.dto.response.MemberProfileRes; | ||
import jungle.HandTris.presentation.dto.response.MemberProfileUpdateDetailsRes; | ||
import jungle.HandTris.presentation.dto.response.ReissueTokenRes; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.web.bind.annotation.*; | ||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/member") | ||
@RequestMapping("/change") | ||
public class MemberProfileController { | ||
private final MemberProfileService memberProfileService; | ||
private final MemberRecordService memberRecordService; | ||
|
||
@GetMapping("/mypage") | ||
public ResponseEnvelope<MemberProfileRes> myPage(@UserNicknameFromJwt String nickname) { | ||
MemberRecord memberRecord = memberRecordService.getMemberRecord(nickname); | ||
MemberProfileRes memberProfileRes = new MemberProfileRes(memberRecord); | ||
return ResponseEnvelope.of(memberProfileRes); | ||
@PutMapping("/profileNickname") // ๋๋ค์ ๋ณ๊ฒฝ | ||
public ResponseEnvelope<ReissueTokenRes> changeNickname (@UserNicknameFromJwt String nickname, @Valid @RequestBody MemberUpdateReq memberUpdateReq) { | ||
|
||
ReissueTokenRes token = memberProfileService.changeMemberNickname(nickname, memberUpdateReq); | ||
|
||
return ResponseEnvelope.of(token); | ||
} | ||
|
||
@PatchMapping("/mypage") | ||
public ResponseEnvelope<MemberProfileUpdateDetailsRes> updateInfo( | ||
HttpServletRequest request, | ||
@Valid MemberUpdateReq memberUpdateReq, | ||
@RequestPart(value = "profileImage", required = false) MultipartFile profileImage, | ||
@RequestParam(value = "deleteProfileImage", required = false, defaultValue = "false") boolean deleteProfileImage | ||
) { | ||
@PatchMapping("/profileImage") // ํ๋กํ ์ด๋ฏธ์ง ๋ณ๊ฒฝ | ||
public ResponseEnvelope<String> changeProfileImage (@UserNicknameFromJwt String nickname, @RequestPart(value = "profileImage") MultipartFile profileImage) { | ||
|
||
MemberProfileUpdateDetailsRes updateMemberDetails = memberProfileService.updateMemberProfile(request, memberUpdateReq, profileImage, deleteProfileImage); | ||
memberProfileService.changeMemberProfileImage(nickname, profileImage); | ||
|
||
return ResponseEnvelope.of(updateMemberDetails); | ||
return ResponseEnvelope.of("Profile Image Change Successful"); | ||
} | ||
|
||
@DeleteMapping("/profileImage") // ํ๋กํ ์ด๋ฏธ์ง ์ ๊ฑฐ | ||
public ResponseEnvelope<String> deleteProfileImage (@UserNicknameFromJwt String nickname) { | ||
|
||
memberProfileService.deleteMemberProfileImage(nickname); | ||
|
||
return ResponseEnvelope.of("Profile Image Delete Successful"); | ||
} | ||
|
||
} |
This file contains 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 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