-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feat] MypageHeader내 userDetails를 통한 조회 기능 구현 및 도메인 형성 #142
- Loading branch information
Showing
2 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
src/main/java/com/gamja/tiggle/mypage/adapter/in/web/GetMyHeaderController.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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package com.gamja.tiggle.mypage.adapter.in.web; | ||
|
||
|
||
import com.gamja.tiggle.common.BaseException; | ||
import com.gamja.tiggle.common.BaseResponse; | ||
import com.gamja.tiggle.common.BaseResponseStatus; | ||
import com.gamja.tiggle.mypage.application.port.in.GetMyHeaderUseCase; | ||
import com.gamja.tiggle.mypage.domain.MyHeaderInfo; | ||
import com.gamja.tiggle.user.domain.CustomUserDetails; | ||
import com.gamja.tiggle.user.domain.User; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.security.core.annotation.AuthenticationPrincipal; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/my-page") | ||
public class GetMyHeaderController { | ||
private final GetMyHeaderUseCase getMyHeaderUseCase; | ||
|
||
@PostMapping("/header") | ||
@Operation(summary = "Mypage 헤더 구현 api", description = "로그인한 사용자의 예매 정보, 포인트 정보, 교환 정보 간략 조회") | ||
BaseResponse getMyHeaderInfo(@AuthenticationPrincipal CustomUserDetails customUserDetails) { | ||
User user = null; | ||
MyHeaderInfo myHeaderInfo = null; | ||
//CustomUserDetails 를 확인하여 로그인한 사용자의 정보와 Role을 확인 | ||
if (customUserDetails != null) { | ||
user = customUserDetails.getUser(); | ||
} | ||
else { | ||
return new BaseResponse(BaseResponseStatus.NOT_FOUND_USER); | ||
} | ||
|
||
try { | ||
myHeaderInfo = getMyHeaderUseCase.getByUserId(user.getId()); | ||
{ | ||
|
||
} | ||
|
||
} catch (BaseException e) { | ||
return new BaseResponse(e.getStatus()); | ||
} | ||
return new BaseResponse<>(myHeaderInfo); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/main/java/com/gamja/tiggle/mypage/domain/MyHeaderInfo.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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.gamja.tiggle.mypage.domain; | ||
|
||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
import java.util.Date; | ||
|
||
@Getter | ||
@Builder | ||
public class MyHeaderInfo { | ||
private String username; | ||
private Integer notWatchedYet; | ||
private Integer reservationCnt; | ||
private Integer point; | ||
} | ||
|