|
10 | 10 | import org.fontory.fontorybe.authentication.adapter.inbound.annotation.Login; |
11 | 11 | import org.fontory.fontorybe.authentication.application.AuthService; |
12 | 12 | import org.fontory.fontorybe.authentication.domain.UserPrincipal; |
13 | | -import org.fontory.fontorybe.authentication.domain.exception.AuthenticationRequiredException; |
14 | 13 | import org.fontory.fontorybe.file.application.port.CloudStorageService; |
15 | 14 | import org.fontory.fontorybe.file.application.port.FileService; |
16 | 15 | import org.fontory.fontorybe.file.domain.FileUploadResult; |
|
21 | 20 | import org.fontory.fontorybe.member.controller.port.MemberLookupService; |
22 | 21 | import org.fontory.fontorybe.member.controller.port.MemberUpdateService; |
23 | 22 | import org.fontory.fontorybe.member.domain.Member; |
| 23 | +import org.fontory.fontorybe.member.domain.exception.MemberNotFoundException; |
24 | 24 | import org.fontory.fontorybe.member.infrastructure.entity.MemberStatus; |
25 | 25 | import org.springframework.http.HttpStatus; |
26 | 26 | import org.springframework.http.ResponseEntity; |
@@ -51,13 +51,18 @@ public class ProfileController { |
51 | 51 | ) |
52 | 52 | @GetMapping |
53 | 53 | public ResponseEntity<MyProfileResponse> getMyProfile( |
54 | | - @Login UserPrincipal me) { |
| 54 | + @Login(required = false) UserPrincipal me) { |
| 55 | + if (me == null) { |
| 56 | + log.info("Request received: getMyInfo - no login"); |
| 57 | + throw new MemberNotFoundException(); |
| 58 | + } |
55 | 59 | Long requestMemberId = me.getId(); |
56 | 60 | log.info("Request received: getMyInfo member ID: {}", requestMemberId); |
57 | 61 |
|
58 | 62 | Member lookupMember = memberLookupService.getOrThrowById(requestMemberId); |
59 | 63 | if (lookupMember.getStatus().equals(MemberStatus.ONBOARDING)) { |
60 | | - throw new AuthenticationRequiredException(); |
| 64 | + log.info("Request received: getMyInfo - member is onboarding"); |
| 65 | + throw new MemberNotFoundException(); |
61 | 66 | } |
62 | 67 | String fileUrl = cloudStorageService.getProfileImageUrl(lookupMember.getProfileImageKey()); |
63 | 68 | log.info("ProfileImageUrl generated : {}", fileUrl); |
|
0 commit comments