diff --git a/build/libs/UserService-0.0.1-SNAPSHOT.jar b/build/libs/UserService-0.0.1-SNAPSHOT.jar index ed99408..cc7f8f0 100644 Binary files a/build/libs/UserService-0.0.1-SNAPSHOT.jar and b/build/libs/UserService-0.0.1-SNAPSHOT.jar differ diff --git a/build/tmp/bootJar/MANIFEST.MF b/build/tmp/bootJar/MANIFEST.MF index 58630c0..e01ee0f 100644 --- a/build/tmp/bootJar/MANIFEST.MF +++ b/build/tmp/bootJar/MANIFEST.MF @@ -1,2 +1,12 @@ Manifest-Version: 1.0 +Main-Class: org.springframework.boot.loader.JarLauncher +Start-Class: com.example.UserService.UserServiceApplication +Spring-Boot-Version: 3.1.3 +Spring-Boot-Classes: BOOT-INF/classes/ +Spring-Boot-Lib: BOOT-INF/lib/ +Spring-Boot-Classpath-Index: BOOT-INF/classpath.idx +Spring-Boot-Layers-Index: BOOT-INF/layers.idx +Build-Jdk-Spec: 17 +Implementation-Title: UserService +Implementation-Version: 0.0.1-SNAPSHOT diff --git a/build/tmp/compileJava/previous-compilation-data.bin b/build/tmp/compileJava/previous-compilation-data.bin index f3b3208..6920f5e 100644 Binary files a/build/tmp/compileJava/previous-compilation-data.bin and b/build/tmp/compileJava/previous-compilation-data.bin differ diff --git a/src/main/java/com/example/UserService/controller/UserController.java b/src/main/java/com/example/UserService/controller/UserController.java index db77fbc..52377ef 100644 --- a/src/main/java/com/example/UserService/controller/UserController.java +++ b/src/main/java/com/example/UserService/controller/UserController.java @@ -4,6 +4,8 @@ import com.example.UserService.dto.EmailVerificationResult; import com.example.UserService.dto.JWTAuthResponse; import com.example.UserService.dto.UserResponse; +import com.example.UserService.exception.BusinessLogicException; +import com.example.UserService.exception.ExceptionCode; import com.example.UserService.service.UserService; import com.example.UserService.vo.RequestLogin; import com.example.UserService.vo.RequestUser; @@ -49,8 +51,15 @@ public ResponseEntity register(@RequestBody RequestUser requestUser){ @GetMapping("/response_userById/{userId}") public ResponseEntity findUserResponseByUserId(@PathVariable("userId") Long userId) { - UserResponse userResponse = userService.getUserResponseByUserId(userId); - return ResponseEntity.ok().body(userResponse); + try { + UserResponse userResponse = userService.getUserResponseByUserId(userId); + return ResponseEntity.ok().body(userResponse); + } catch (BusinessLogicException e) { + ExceptionCode exceptionCode = e.getExceptionCode(); + int status = exceptionCode.getStatus(); + String message = exceptionCode.getMessage(); + return ResponseEntity.status(status).body(new UserResponse(message)); + } } @GetMapping("/response_userByEmail/{email}") diff --git a/src/main/java/com/example/UserService/dto/UserResponse.java b/src/main/java/com/example/UserService/dto/UserResponse.java index 226405e..59685f9 100644 --- a/src/main/java/com/example/UserService/dto/UserResponse.java +++ b/src/main/java/com/example/UserService/dto/UserResponse.java @@ -3,6 +3,7 @@ import lombok.Getter; //feignClient 응답용 + @Getter public class UserResponse { private Long id; @@ -10,6 +11,7 @@ public class UserResponse { private String name; private String phoneNumber; private boolean isApproved; + private String message; public UserResponse(Long id, String email, String name, String phoneNumber, boolean isApproved) { this.id = id; @@ -18,4 +20,8 @@ public UserResponse(Long id, String email, String name, String phoneNumber, bool this.phoneNumber = phoneNumber; this.isApproved = isApproved; } + + public UserResponse(String message) { + this.message = message; + } } diff --git a/src/main/java/com/example/UserService/service/UserServiceImpl.java b/src/main/java/com/example/UserService/service/UserServiceImpl.java index 36562b4..2e09bd0 100644 --- a/src/main/java/com/example/UserService/service/UserServiceImpl.java +++ b/src/main/java/com/example/UserService/service/UserServiceImpl.java @@ -86,7 +86,13 @@ public String register(RequestUser requestUser) { @Override public UserResponse getUserResponseByUserId(Long userId) { - return userRepository.findUserResponseByUserId(userId); + UserResponse userResponse = userRepository.findUserResponseByUserId(userId); + + if (userResponse == null) { + throw new BusinessLogicException(ExceptionCode.MEMBER_NOT_FOUND); + } + + return userResponse; } @Override