diff --git a/server/src/main/java/com/yogit/server/user/controller/UserController.java b/server/src/main/java/com/yogit/server/user/controller/UserController.java index ddfdc1b..d7dbe6f 100644 --- a/server/src/main/java/com/yogit/server/user/controller/UserController.java +++ b/server/src/main/java/com/yogit/server/user/controller/UserController.java @@ -264,10 +264,8 @@ public ApplicationResponse addDeviceToken(@ModelAttribute Ad }) @PostMapping(value = "/log-out") @ResponseBody - public ApplicationResponse logInApple(@ModelAttribute LogoutReq logoutReq) { + public ApplicationResponse logInApple(@ModelAttribute LogoutReq logoutReq) { - userService.logout(logoutReq); - - return ApplicationResponse.ok("로그아웃에 성공했습니다."); + return userService.logout(logoutReq); } } diff --git a/server/src/main/java/com/yogit/server/user/dto/response/LogoutRes.java b/server/src/main/java/com/yogit/server/user/dto/response/LogoutRes.java new file mode 100644 index 0000000..846da22 --- /dev/null +++ b/server/src/main/java/com/yogit/server/user/dto/response/LogoutRes.java @@ -0,0 +1,12 @@ +package com.yogit.server.user.dto.response; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@NoArgsConstructor +@AllArgsConstructor +@Data +public class LogoutRes { + String userStatus; +} diff --git a/server/src/main/java/com/yogit/server/user/service/UserService.java b/server/src/main/java/com/yogit/server/user/service/UserService.java index 7fc5a9d..7f8e106 100644 --- a/server/src/main/java/com/yogit/server/user/service/UserService.java +++ b/server/src/main/java/com/yogit/server/user/service/UserService.java @@ -28,5 +28,5 @@ public interface UserService { ApplicationResponse addDeviceToken(AddUserDeviceTokenReq addUserDeviceTokenReq); - void logout(LogoutReq logoutReq); + ApplicationResponse logout(LogoutReq logoutReq); } diff --git a/server/src/main/java/com/yogit/server/user/service/UserServiceImpl.java b/server/src/main/java/com/yogit/server/user/service/UserServiceImpl.java index b35a499..789a4e2 100644 --- a/server/src/main/java/com/yogit/server/user/service/UserServiceImpl.java +++ b/server/src/main/java/com/yogit/server/user/service/UserServiceImpl.java @@ -318,12 +318,16 @@ public ApplicationResponse addDeviceToken(AddUserDeviceToken @Override @Transactional - public void logout(LogoutReq logoutReq){ + public ApplicationResponse logout(LogoutReq logoutReq){ validateRefreshToken(logoutReq.getUserId(), logoutReq.getRefreshToken()); User user = userRepository.findByUserId(logoutReq.getUserId()).orElseThrow(NotFoundUserException::new); user.changeUserStatus(UserStatus.LOGOUT); + + LogoutRes logoutRes = new LogoutRes(UserStatus.LOGOUT.toString()); + + return ApplicationResponse.ok(logoutRes); } }