From 35dd887e5fa2794ee7a89fc57936e3a5797825ea Mon Sep 17 00:00:00 2001 From: YongHo Shin Date: Thu, 10 Aug 2023 18:40:19 +0900 Subject: [PATCH] =?UTF-8?q?hotfix:=20/api/user/healthcheck,=20/api/admin/u?= =?UTF-8?q?ser/healthcheck=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/user/controller/UserController.java | 47 ++++++++++--------- .../user/controller/UserController.java | 6 +++ .../core/config/_security/SecurityConfig.java | 2 + 3 files changed, 34 insertions(+), 21 deletions(-) diff --git a/admin/src/main/java/com/example/admin/user/controller/UserController.java b/admin/src/main/java/com/example/admin/user/controller/UserController.java index 1ace9a7..6a81ea9 100644 --- a/admin/src/main/java/com/example/admin/user/controller/UserController.java +++ b/admin/src/main/java/com/example/admin/user/controller/UserController.java @@ -22,25 +22,30 @@ @RequestMapping("/api/admin/user") public class UserController { - private final UserService userService; - - @GetMapping("/list") - public ResponseEntity> list( - @PageableDefault(size = 10) Pageable pageable) { - log.info("GET /api/admin/user/list " + pageable); - - Page listResponse = userService.getAllUsers(pageable); - return ResponseEntity.ok(ApiResponse.success(listResponse)); - } - - @PostMapping("/signIn") - public ResponseEntity> signIn( - @RequestBody @Valid UserRequest.SignInDTO signInDTO, - Errors errors) { - log.info("POST /api/admin/user/signIn" + signInDTO); - - UserResponse.SignInDTO signInResponse = userService.signIn(signInDTO); - return ResponseEntity.ok() - .header(JwtTokenProvider.HEADER, signInResponse.getJwt()) - .body(ApiResponse.success());} + private final UserService userService; + + @RequestMapping("/healthcheck") + public ResponseEntity> healthcheck() { + return ResponseEntity.ok(ApiResponse.success()); + } + + @GetMapping("/list") + public ResponseEntity> list( + @PageableDefault(size = 10) Pageable pageable) { + log.info("GET /api/admin/user/list " + pageable); + + Page listResponse = userService.getAllUsers(pageable); + return ResponseEntity.ok(ApiResponse.success(listResponse)); + } + + @PostMapping("/signIn") + public ResponseEntity> signIn( + @RequestBody @Valid UserRequest.SignInDTO signInDTO, Errors errors) { + log.info("POST /api/admin/user/signIn" + signInDTO); + + UserResponse.SignInDTO signInResponse = userService.signIn(signInDTO); + return ResponseEntity.ok() + .header(JwtTokenProvider.HEADER, signInResponse.getJwt()) + .body(ApiResponse.success()); + } } diff --git a/application/src/main/java/com/example/application/user/controller/UserController.java b/application/src/main/java/com/example/application/user/controller/UserController.java index 6352ef9..09f821c 100644 --- a/application/src/main/java/com/example/application/user/controller/UserController.java +++ b/application/src/main/java/com/example/application/user/controller/UserController.java @@ -31,6 +31,12 @@ public class UserController { private final LoggingService loggingService; private final MailService mailService; + @RequestMapping("/healthcheck") + public ResponseEntity> signup() { + + return ResponseEntity.ok(ApiResponse.success()); + } + @PostMapping("/signup") public ResponseEntity> signup( @RequestBody @Valid UserRequest.SignUpDTO signUpDTO, Errors errors) { diff --git a/core/src/main/java/com/example/core/config/_security/SecurityConfig.java b/core/src/main/java/com/example/core/config/_security/SecurityConfig.java index 1c9efa6..dd74648 100644 --- a/core/src/main/java/com/example/core/config/_security/SecurityConfig.java +++ b/core/src/main/java/com/example/core/config/_security/SecurityConfig.java @@ -75,6 +75,8 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { expressionInterceptUrlRegistry -> expressionInterceptUrlRegistry .antMatchers( + "/api/admin/user/healthcheck", + "/api/user/healthcheck", "/api/admin/user/signIn", "/api/user/signin", "/api/user/signup",