File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed
src/main/java/org/ezcode/codetest
presentation/usermanagement Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -126,4 +126,13 @@ public UserGitubAutoPushResponse changeAutoPushSetting(AuthUser authUser) {
126126
127127 return new UserGitubAutoPushResponse ("변경되었습니다" , user .getGitPushStatus ());
128128 }
129+
130+ public UserGitubAutoPushResponse getAutoPushStatus (AuthUser authUser ) {
131+ UserGithubInfo userGithubInfo = userGithubInfoRepository .getUserGithubInfo (authUser .getId ());
132+ if (userGithubInfo == null ) { //유저의 깃허브 정보가 없으면 에러 반환
133+ throw new UserException (UserExceptionCode .NO_GITHUB_INFO );
134+ }
135+ User user = userGithubInfo .getUser ();
136+ return new UserGitubAutoPushResponse ("현재 githubAutoPush 설정" , user .getGitPushStatus ());
137+ }
129138}
Original file line number Diff line number Diff line change @@ -54,4 +54,15 @@ public ResponseEntity<UserGitubAutoPushResponse> changeAutoPushSetting(
5454 ){
5555 return ResponseEntity .status (HttpStatus .OK ).body (userGithubService .changeAutoPushSetting (authUser ));
5656 }
57+
58+ @ Operation (
59+ summary = "깃허브 자동 push 여부 true false 조회" ,
60+ description = "유저 DB에서 autoPush 여부를 찾아 true/false로 반환합니다. ex- message : '현재 githubAutoPush 설정', gitPushStatus : true "
61+ )
62+ @ GetMapping ("/users/github/status" )
63+ public ResponseEntity <UserGitubAutoPushResponse > AutoPushStatus (
64+ @ AuthenticationPrincipal AuthUser authUser
65+ ){
66+ return ResponseEntity .status (HttpStatus .OK ).body (userGithubService .getAutoPushStatus (authUser ));
67+ }
5768}
You can’t perform that action at this time.
0 commit comments