From bb13a1862e58a26c57db57c1036c29e5ce7a9d0e Mon Sep 17 00:00:00 2001 From: lee-june-young Date: Sat, 31 Aug 2024 00:26:00 +0900 Subject: [PATCH] =?UTF-8?q?[fix][#93]=20=EC=98=A8=EB=B3=B4=EB=94=A9=20?= =?UTF-8?q?=EC=83=81=ED=83=9C=20=EC=A1=B0=ED=9A=8C=20&=20=EC=98=A8?= =?UTF-8?q?=EB=B3=B4=EB=94=A9=20=EC=83=81=ED=83=9C=20=EC=97=85=EB=8D=B0?= =?UTF-8?q?=EC=9D=B4=ED=8A=B8=20api=20=EB=A6=AC=ED=84=B4=EA=B0=92,=20?= =?UTF-8?q?=EC=9A=94=EC=B2=AD=EA=B0=92=20=EB=B6=88=EB=A6=B0=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=ED=95=98=EA=B2=8C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bbo_gak/domain/user/controller/UserController.java | 2 +- .../dto/request/UserOnboardStatusUpdateRequest.java | 2 +- .../dto/response/UserOnboardStatusGetResponse.java | 2 +- .../bbo_gak/domain/user/entity/OnboardStatus.java | 10 +++++----- .../bbo_gak/domain/user/service/UserService.java | 2 +- .../bbo_gak/domain/user/service/UserServiceImpl.java | 4 ++-- .../bbo_gak/global/error/exception/ErrorCode.java | 2 +- .../domain/user/controller/UserControllerTest.java | 6 +++--- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/server/bbo_gak/domain/user/controller/UserController.java b/src/main/java/com/server/bbo_gak/domain/user/controller/UserController.java index f469fe7..e579a84 100644 --- a/src/main/java/com/server/bbo_gak/domain/user/controller/UserController.java +++ b/src/main/java/com/server/bbo_gak/domain/user/controller/UserController.java @@ -48,7 +48,7 @@ public ResponseEntity updateMemberOnboardStatus( @AuthUser User user, @RequestBody UserOnboardStatusUpdateRequest request ) { - userService.updateUserOnboardStatus(user, request.onboardStatus()); + userService.updateUserOnboardStatus(user, request.isOnboardComplete()); return ResponseEntity.ok(null); } diff --git a/src/main/java/com/server/bbo_gak/domain/user/dto/request/UserOnboardStatusUpdateRequest.java b/src/main/java/com/server/bbo_gak/domain/user/dto/request/UserOnboardStatusUpdateRequest.java index d05443a..5ce7401 100644 --- a/src/main/java/com/server/bbo_gak/domain/user/dto/request/UserOnboardStatusUpdateRequest.java +++ b/src/main/java/com/server/bbo_gak/domain/user/dto/request/UserOnboardStatusUpdateRequest.java @@ -1,4 +1,4 @@ package com.server.bbo_gak.domain.user.dto.request; -public record UserOnboardStatusUpdateRequest(String onboardStatus) { +public record UserOnboardStatusUpdateRequest(Boolean isOnboardComplete) { } diff --git a/src/main/java/com/server/bbo_gak/domain/user/dto/response/UserOnboardStatusGetResponse.java b/src/main/java/com/server/bbo_gak/domain/user/dto/response/UserOnboardStatusGetResponse.java index 73096a1..5cc2b36 100644 --- a/src/main/java/com/server/bbo_gak/domain/user/dto/response/UserOnboardStatusGetResponse.java +++ b/src/main/java/com/server/bbo_gak/domain/user/dto/response/UserOnboardStatusGetResponse.java @@ -1,7 +1,7 @@ package com.server.bbo_gak.domain.user.dto.response; public record UserOnboardStatusGetResponse( - String onboardStatus + Boolean isOnboardComplete ) { } diff --git a/src/main/java/com/server/bbo_gak/domain/user/entity/OnboardStatus.java b/src/main/java/com/server/bbo_gak/domain/user/entity/OnboardStatus.java index 1777eea..d373560 100644 --- a/src/main/java/com/server/bbo_gak/domain/user/entity/OnboardStatus.java +++ b/src/main/java/com/server/bbo_gak/domain/user/entity/OnboardStatus.java @@ -9,14 +9,14 @@ @Getter @AllArgsConstructor public enum OnboardStatus { - NOT_STARTED("온보딩_미완료"), - COMPLETED("온보딩_완료"); + NOT_STARTED(false), + COMPLETED(true); - private final String value; + private final Boolean value; // 온보딩 수행 여부 (true면 온보딩 완료) - public static OnboardStatus findByValue(String value) { + public static OnboardStatus findByValue(Boolean isOnboardComplete) { return Arrays.stream(OnboardStatus.values()) - .filter(onboardStatus -> onboardStatus.getValue().equals(value)) + .filter(onboardStatus -> onboardStatus.getValue().equals(isOnboardComplete)) .findFirst() .orElseThrow((() -> new NotFoundException(ErrorCode.ONBOARD_STATUS_NOT_FOUND))); } diff --git a/src/main/java/com/server/bbo_gak/domain/user/service/UserService.java b/src/main/java/com/server/bbo_gak/domain/user/service/UserService.java index 81e470b..3353ea1 100644 --- a/src/main/java/com/server/bbo_gak/domain/user/service/UserService.java +++ b/src/main/java/com/server/bbo_gak/domain/user/service/UserService.java @@ -12,7 +12,7 @@ public interface UserService { void updateUserJob(User user, String job); - void updateUserOnboardStatus(User user, String onboardStatus); + void updateUserOnboardStatus(User user, Boolean isOnboardComplete); void getUser(); diff --git a/src/main/java/com/server/bbo_gak/domain/user/service/UserServiceImpl.java b/src/main/java/com/server/bbo_gak/domain/user/service/UserServiceImpl.java index aa17091..a2fd14d 100644 --- a/src/main/java/com/server/bbo_gak/domain/user/service/UserServiceImpl.java +++ b/src/main/java/com/server/bbo_gak/domain/user/service/UserServiceImpl.java @@ -37,8 +37,8 @@ public void updateUserJob(User user, String job) { } @Transactional - public void updateUserOnboardStatus(User user, String onboardStatus){ - user.updateOnboardStatus(OnboardStatus.findByValue(onboardStatus)); + public void updateUserOnboardStatus(User user, Boolean isOnboardComplete){ + user.updateOnboardStatus(OnboardStatus.findByValue(isOnboardComplete)); userRepository.save(user); } diff --git a/src/main/java/com/server/bbo_gak/global/error/exception/ErrorCode.java b/src/main/java/com/server/bbo_gak/global/error/exception/ErrorCode.java index 04ab3c2..1f7363a 100644 --- a/src/main/java/com/server/bbo_gak/global/error/exception/ErrorCode.java +++ b/src/main/java/com/server/bbo_gak/global/error/exception/ErrorCode.java @@ -33,7 +33,7 @@ public enum ErrorCode { //User USER_NOT_FOUND(HttpStatus.NOT_FOUND, "해당 유저를 찾을 수 없습니다."), JOB_NOT_FOUND(HttpStatus.NOT_FOUND, "해당 직업을 찾을 수 없습니다"), - ONBOARD_STATUS_NOT_FOUND(HttpStatus.NOT_FOUND, "해당 온보딩 상태를 찾을 수 없습니다"), + ONBOARD_STATUS_NOT_FOUND(HttpStatus.NOT_FOUND, "해당 온보딩 상태를 찾을 수 없습니다. (잘못된 온보딩 상태를 입력하셨습니다)"), //Image IMAGE_FILE_EXTENSION_NOT_FOUND(HttpStatus.BAD_REQUEST, "지원하지 않는 파일 확장자입니다."), diff --git a/src/test/java/com/server/bbo_gak/domain/user/controller/UserControllerTest.java b/src/test/java/com/server/bbo_gak/domain/user/controller/UserControllerTest.java index 6ad2516..9e294e3 100644 --- a/src/test/java/com/server/bbo_gak/domain/user/controller/UserControllerTest.java +++ b/src/test/java/com/server/bbo_gak/domain/user/controller/UserControllerTest.java @@ -50,7 +50,7 @@ class 온보딩상태_조회 { public void 성공_온보딩_완료_상태() throws Exception { //given - UserOnboardStatusGetResponse response = new UserOnboardStatusGetResponse("온보딩_완료"); + UserOnboardStatusGetResponse response = new UserOnboardStatusGetResponse(true); //then mockMvc.perform(restDocsFactory.createRequest(DEFAULT_URL + "/onboard-status", null, HttpMethod.GET, @@ -64,7 +64,7 @@ class 온보딩상태_조회 { public void 성공_온보딩_미완료_상태() throws Exception { //given - UserOnboardStatusGetResponse response = new UserOnboardStatusGetResponse("온보딩_미완료"); + UserOnboardStatusGetResponse response = new UserOnboardStatusGetResponse(false); //then mockMvc.perform(restDocsFactory.createRequest(DEFAULT_URL + "/onboard-status", null, HttpMethod.GET, @@ -82,7 +82,7 @@ class 온보딩상태_업데이트 { public void 성공() throws Exception { //given - UserOnboardStatusUpdateRequest request = new UserOnboardStatusUpdateRequest("온보딩_완료"); + UserOnboardStatusUpdateRequest request = new UserOnboardStatusUpdateRequest(true); //then mockMvc.perform(restDocsFactory.createRequest(DEFAULT_URL + "/onboard-status", request, HttpMethod.PUT,