-
Notifications
You must be signed in to change notification settings - Fork 1
[REFACTOR] #195: API 공통 응답 리팩토링 #198
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
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
b69f983
refactor(#195/*): jpa 및 DB 시간 설정 UTC로 변경
kaswhy 812d56f
refactor(#195/*): BaseEntity 패키지 이름 변경
kaswhy 7a7abff
refactor(#195/*): API 공통 응답 변경
kaswhy 0a42e2c
refactor(#195/auth): AuthController 바뀐 공통 응답에 맞게 리팩토링
kaswhy aba0abc
refactor(#195/game): Game 관련 도메인 변경된 공통 API 응답에 맞게 리팩토링
kaswhy 26431d5
refactor(#195/recruit): recruit 관련 도메인을 공통 api 응답 변경에 맞게 리팩토링
kaswhy 03d2c51
refactor(#195/resource): resource 관련 도메인 공통 api 응답 변경에 맞게 리팩토링
kaswhy b6533cb
refactor(#195/study): study 관련 도메인 공통 api 응답 변경에 맞게 리팩토링
kaswhy a4d782f
refactor(#195/user): user 관련 도메인 공통 api 응답 변경에 맞게 리팩토링
kaswhy 9c5af7a
refactor(#195/domain): 전체 api versioning 추가
kaswhy 097aa64
refactor(#195/game): 게임 랭킹 api versioning 추가
kaswhy fd6ea91
refactor(#195/resource): prod, dev 환경 jdbc time-zone 설정 utc로 변경
kaswhy 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
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 |
|---|---|---|
| @@ -1,23 +1,13 @@ | ||
| package inha.gdgoc; | ||
|
|
||
| import jakarta.annotation.PostConstruct; | ||
| import java.util.TimeZone; | ||
| import org.springframework.boot.SpringApplication; | ||
| import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
| import org.springframework.data.jpa.repository.config.EnableJpaAuditing; | ||
|
|
||
| @EnableJpaAuditing | ||
| @SpringBootApplication | ||
| // @EnableConfigurationProperties(JwtProperties.class) | ||
| public class GdgocApplication { | ||
|
|
||
| public static void main(String[] args) { | ||
| SpringApplication.run(GdgocApplication.class, args); | ||
| } | ||
|
|
||
| @PostConstruct | ||
| public void init() { | ||
| TimeZone.setDefault(TimeZone.getTimeZone("Asia/Seoul")); | ||
| } | ||
|
|
||
| } |
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
11 changes: 11 additions & 0 deletions
11
src/main/java/inha/gdgoc/domain/auth/controller/message/AuthMessage.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,11 @@ | ||
| package inha.gdgoc.domain.auth.controller.message; | ||
|
|
||
| public class AuthMessage { | ||
| public static final String OAUTH_LOGIN_SIGNUP_SUCCESS = "로그인/회원가입 요청이 성공적으로 실행됐습니다."; | ||
| public static final String ACCESS_TOKEN_REFRESH_SUCCESS = "액세스 토큰이 성공적으로 재발급되었습니다."; | ||
| public static final String LOGIN_WITH_PASSWORD_SUCCESS = "성공적으로 비밀번호를 사용하여 로그인했습니다."; | ||
| public static final String LOGOUT_SUCCESS = "성공적으로 로그아웃했습니다."; | ||
| public static final String CODE_CREATION_SUCCESS = "성공적으로 인증 코드를 발급했습니다."; | ||
| public static final String PASSWORD_RESET_VERIFICATION_SUCCESS = "성공적으로 비밀번호 변경을 위한 인증 코드 검증이 완료되었습니다."; | ||
| public static final String PASSWORD_CHANGE_SUCCESS = "성공적으로 비밀번호를 변경했습니다."; | ||
| } |
2 changes: 1 addition & 1 deletion
2
src/main/java/inha/gdgoc/domain/auth/dto/request/FindIdRequest.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
2 changes: 1 addition & 1 deletion
2
src/main/java/inha/gdgoc/domain/auth/dto/response/AccessTokenResponse.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
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
26 changes: 17 additions & 9 deletions
26
src/main/java/inha/gdgoc/domain/game/controller/GameQuestionController.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 |
|---|---|---|
| @@ -1,34 +1,42 @@ | ||
| package inha.gdgoc.domain.game.controller; | ||
|
|
||
| import static inha.gdgoc.domain.game.controller.message.GameQuestionMessage.GAME_QUESTION_RETRIEVED_SUCCESS; | ||
| import static inha.gdgoc.domain.game.controller.message.GameQuestionMessage.GAME_QUESTION_SAVE_SUCCESS; | ||
|
|
||
| import inha.gdgoc.domain.game.dto.request.GameQuestionRequest; | ||
| import inha.gdgoc.domain.game.dto.response.GameQuestionResponse; | ||
| import inha.gdgoc.domain.game.entity.GameQuestion; | ||
| import inha.gdgoc.domain.game.service.GameQuestionService; | ||
| import inha.gdgoc.global.common.ApiResponse; | ||
| import inha.gdgoc.global.dto.response.ApiResponse; | ||
| import java.util.List; | ||
| import lombok.RequiredArgsConstructor; | ||
| import org.springframework.http.ResponseEntity; | ||
| import org.springframework.web.bind.annotation.GetMapping; | ||
| import org.springframework.web.bind.annotation.PostMapping; | ||
| import org.springframework.web.bind.annotation.RequestBody; | ||
| import org.springframework.web.bind.annotation.RequestMapping; | ||
| import org.springframework.web.bind.annotation.RestController; | ||
|
|
||
| @RequestMapping("/api/v1/game/questions") | ||
| @RequiredArgsConstructor | ||
| @RestController | ||
| public class GameQuestionController { | ||
|
|
||
| private final GameQuestionService gameQuestionService; | ||
|
|
||
| @PostMapping("/game/question") | ||
| public ResponseEntity<ApiResponse<GameQuestionRequest>> saveQuestion( | ||
| @RequestBody GameQuestionRequest gameQuestionRequest) { | ||
| // 얘 api 엔드포인트 바뀜! | ||
| @PostMapping | ||
| public ResponseEntity<ApiResponse<Void, Void>> saveQuestion( | ||
| @RequestBody GameQuestionRequest gameQuestionRequest | ||
| ) { | ||
| gameQuestionService.saveQuestion(gameQuestionRequest); | ||
|
|
||
| return ResponseEntity.ok(ApiResponse.of(null)); | ||
| return ResponseEntity.ok(ApiResponse.ok(GAME_QUESTION_SAVE_SUCCESS)); | ||
| } | ||
|
|
||
| @GetMapping("/game/questions") | ||
| public ResponseEntity<ApiResponse<List<GameQuestionResponse>>> getRandomGameQuestions() { | ||
| return ResponseEntity.ok(ApiResponse.of(gameQuestionService.getRandomQuestionsByLanguage())); | ||
| @GetMapping | ||
| public ResponseEntity<ApiResponse<List<GameQuestionResponse>, Void>> getRandomGameQuestions() { | ||
| List<GameQuestionResponse> response = gameQuestionService.getRandomQuestionsByLanguage(); | ||
|
|
||
| return ResponseEntity.ok(ApiResponse.ok(GAME_QUESTION_RETRIEVED_SUCCESS, response)); | ||
| } | ||
| } |
25 changes: 18 additions & 7 deletions
25
src/main/java/inha/gdgoc/domain/game/controller/GameUserController.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 |
|---|---|---|
| @@ -1,30 +1,41 @@ | ||
| package inha.gdgoc.domain.game.controller; | ||
|
|
||
| import static inha.gdgoc.domain.game.controller.message.GameUserMessage.GAME_RANK_RETRIEVED_SUCCESS; | ||
| import static inha.gdgoc.domain.game.controller.message.GameUserMessage.GAME_RANK_SAVE_SUCCESS; | ||
|
|
||
| import inha.gdgoc.domain.game.dto.request.GameUserRequest; | ||
| import inha.gdgoc.domain.game.dto.response.GameUserResponse; | ||
| import inha.gdgoc.domain.game.service.GameUserService; | ||
| import inha.gdgoc.global.common.ApiResponse; | ||
| import inha.gdgoc.global.dto.response.ApiResponse; | ||
| import java.util.List; | ||
| import lombok.RequiredArgsConstructor; | ||
| import org.springframework.http.ResponseEntity; | ||
| import org.springframework.web.bind.annotation.GetMapping; | ||
| import org.springframework.web.bind.annotation.PostMapping; | ||
| import org.springframework.web.bind.annotation.RequestBody; | ||
| import org.springframework.web.bind.annotation.RequestMapping; | ||
| import org.springframework.web.bind.annotation.RestController; | ||
|
|
||
| @RequestMapping("/api/v1/game") | ||
| @RequiredArgsConstructor | ||
| @RestController | ||
| public class GameUserController { | ||
|
|
||
| private final GameUserService gameUserService; | ||
|
|
||
| @PostMapping("/game/result") | ||
| public ResponseEntity<ApiResponse<List<GameUserResponse>>> saveGameResult(@RequestBody GameUserRequest request) { | ||
| return ResponseEntity.ok(ApiResponse.of(gameUserService.saveGameResultAndGetRanking(request))); | ||
| @PostMapping("/result") | ||
| public ResponseEntity<ApiResponse<List<GameUserResponse>, Void>> saveGameResult( | ||
| @RequestBody GameUserRequest request | ||
| ) { | ||
| List<GameUserResponse> response = gameUserService.saveGameResultAndGetRanking(request); | ||
|
|
||
| return ResponseEntity.ok(ApiResponse.ok(GAME_RANK_SAVE_SUCCESS, response)); | ||
| } | ||
kaswhy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| @GetMapping("/game/results") | ||
| public ResponseEntity<ApiResponse<List<GameUserResponse>>> getUserRankings() { | ||
| return ResponseEntity.ok(ApiResponse.of(gameUserService.findUserRankings())); | ||
| @GetMapping("/results") | ||
| public ResponseEntity<ApiResponse<List<GameUserResponse>, Void>> getUserRankings() { | ||
| List<GameUserResponse> response = gameUserService.findUserRankings(); | ||
|
|
||
| return ResponseEntity.ok(ApiResponse.ok(GAME_RANK_RETRIEVED_SUCCESS, response)); | ||
| } | ||
| } | ||
6 changes: 6 additions & 0 deletions
6
src/main/java/inha/gdgoc/domain/game/controller/message/GameQuestionMessage.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,6 @@ | ||
| package inha.gdgoc.domain.game.controller.message; | ||
|
|
||
| public class GameQuestionMessage { | ||
| public static final String GAME_QUESTION_SAVE_SUCCESS = "성공적으로 게임 질문을 저장했습니다."; | ||
| public static final String GAME_QUESTION_RETRIEVED_SUCCESS = "성공적으로 게임 질문 리스트를 조회했습니다."; | ||
| } |
6 changes: 6 additions & 0 deletions
6
src/main/java/inha/gdgoc/domain/game/controller/message/GameUserMessage.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,6 @@ | ||
| package inha.gdgoc.domain.game.controller.message; | ||
|
|
||
| public class GameUserMessage { | ||
| public static final String GAME_RANK_SAVE_SUCCESS = "성공적으로 유저 랭킹 정보를 저장했습니다."; | ||
| public static final String GAME_RANK_RETRIEVED_SUCCESS = "성공적으로 랭킹 정보를 반환했습니다."; | ||
| } |
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.