diff --git a/src/main/java/ac/kr/deu/connect/luck/auth/AuthRestController.java b/src/main/java/ac/kr/deu/connect/luck/auth/AuthRestController.java index 798d3f6..2ba1bb7 100644 --- a/src/main/java/ac/kr/deu/connect/luck/auth/AuthRestController.java +++ b/src/main/java/ac/kr/deu/connect/luck/auth/AuthRestController.java @@ -38,7 +38,7 @@ public User login( @ApiResponse(responseCode = "400", description = "회원가입 실패", content = @Content(schema = @Schema(implementation = CustomErrorResponse.class))) }) public User signUp( - @Parameter(description = "회원가입 요청 정보") @RequestBody SignUpRequest signUpRequest) { + @Parameter(name = "로그인 객체", description = "회원가입 요청 정보") @RequestBody SignUpRequest signUpRequest) { return authService.signUp(signUpRequest); } diff --git a/src/main/java/ac/kr/deu/connect/luck/auth/LoginRequest.java b/src/main/java/ac/kr/deu/connect/luck/auth/LoginRequest.java index 62de2db..0c77bd4 100644 --- a/src/main/java/ac/kr/deu/connect/luck/auth/LoginRequest.java +++ b/src/main/java/ac/kr/deu/connect/luck/auth/LoginRequest.java @@ -4,9 +4,9 @@ @Schema(description = "로그인 요청 정보 객체") public record LoginRequest( - @Schema(description = "이메일", example = "test@test.com") + @Schema(description = "이메일", example = "test1@test.com") String email, - @Schema(description = "비밀번호", example = "test1234") + @Schema(description = "비밀번호", example = "test1") String password ) { } diff --git a/src/main/java/ac/kr/deu/connect/luck/food_truck/FoodTruckMenu.java b/src/main/java/ac/kr/deu/connect/luck/food_truck/FoodTruckMenu.java index 1288d23..60e9486 100644 --- a/src/main/java/ac/kr/deu/connect/luck/food_truck/FoodTruckMenu.java +++ b/src/main/java/ac/kr/deu/connect/luck/food_truck/FoodTruckMenu.java @@ -18,7 +18,6 @@ public class FoodTruckMenu extends BaseEntity { private String description; private String imageUrl; private int price; - private int quantity; @ManyToOne private FoodTruck foodTruck; } diff --git a/src/main/java/ac/kr/deu/connect/luck/food_truck/FoodTruckMenuRequest.java b/src/main/java/ac/kr/deu/connect/luck/food_truck/FoodTruckMenuRequest.java new file mode 100644 index 0000000..7f20f1b --- /dev/null +++ b/src/main/java/ac/kr/deu/connect/luck/food_truck/FoodTruckMenuRequest.java @@ -0,0 +1,17 @@ +package ac.kr.deu.connect.luck.food_truck; + +import io.swagger.v3.oas.annotations.media.Schema; + +public record FoodTruckMenuRequest( + @Schema(description = "메뉴 이름", example = "맛있는 푸드트럭") + String name, + @Schema(description = "메뉴 설명", example = "맛있는 음식") + String description, + @Schema(description = "메뉴 사진 URL", example = "https://picsum.photos/1600/900") + String imageUrl, + @Schema(description = "가격", example = "10000") + int price, + @Schema(description = "트럭 ID", example = "1") + Long foodTruckId +) { +} diff --git a/src/main/java/ac/kr/deu/connect/luck/food_truck/FoodTruckRequest.java b/src/main/java/ac/kr/deu/connect/luck/food_truck/FoodTruckRequest.java index 13ccc5c..5988776 100644 --- a/src/main/java/ac/kr/deu/connect/luck/food_truck/FoodTruckRequest.java +++ b/src/main/java/ac/kr/deu/connect/luck/food_truck/FoodTruckRequest.java @@ -1,10 +1,17 @@ package ac.kr.deu.connect.luck.food_truck; +import io.swagger.v3.oas.annotations.media.Schema; + public record FoodTruckRequest( + @Schema(description = "푸드트럭 이름", example = "맛있는 푸드트럭") String name, + @Schema(description = "푸드트럭 설명", example = "맛있는 음식") String description, + @Schema(description = "푸드트럭 이미지 URL", example = "https://picsum.photos/1600/900") String imageUrl, + @Schema(description = "매니저 ID", example = "4") Long userId, + @Schema(description = "음식 종류", example = "KOREAN") FoodType foodType ) { } diff --git a/src/main/java/ac/kr/deu/connect/luck/food_truck/FoodTruckRestController.java b/src/main/java/ac/kr/deu/connect/luck/food_truck/FoodTruckRestController.java index 1b5d78a..5f6d335 100644 --- a/src/main/java/ac/kr/deu/connect/luck/food_truck/FoodTruckRestController.java +++ b/src/main/java/ac/kr/deu/connect/luck/food_truck/FoodTruckRestController.java @@ -33,7 +33,7 @@ public ResponseEntity> getFoodTrucks() { @GetMapping("/{id}") @Operation(summary = "Get a food truck by id") public ResponseEntity getFoodTruck( - @PathVariable Long id) { + @Parameter(name = "id", description = "트럭 ID를 조회") @PathVariable Long id) { return ResponseEntity.ok(foodTruckService.getFoodTruck(id)); } @@ -48,10 +48,10 @@ public ResponseEntity updateFoodTruck( @DeleteMapping("/{id}") @Operation(summary = "Delete a food truck by id") - public ResponseEntity deleteFoodTruck( + public ResponseEntity deleteFoodTruck( @PathVariable Long id) { - foodTruckService.deleteFoodTruck(id); - return ResponseEntity.noContent().build(); + + return ResponseEntity.ok(foodTruckService.deleteFoodTruck(id)); } @PostMapping("/be-manager") diff --git a/src/main/java/ac/kr/deu/connect/luck/user/UserService.java b/src/main/java/ac/kr/deu/connect/luck/user/UserService.java index b956b70..15e42ff 100644 --- a/src/main/java/ac/kr/deu/connect/luck/user/UserService.java +++ b/src/main/java/ac/kr/deu/connect/luck/user/UserService.java @@ -29,7 +29,7 @@ public class UserService { */ @Transactional public String deleteUser(Long id) { - User user = userRepository.findById(id).orElseThrow(() -> new CustomException(CustomErrorCode.ID_NOT_MATCH)); + User user = userRepository.findById(id).orElseThrow(() -> new CustomException(CustomErrorCode.USER_ID_NOT_MATCH)); foodTruckReviewRepository.deleteAllByAuthor(user); eventRepository.deleteByManager(user); for (FoodTruck foodTruck : foodTruckRepository.findByManager(user)) { @@ -41,11 +41,11 @@ public String deleteUser(Long id) { } public User findUserById(Long id) { - return userRepository.findById(id).orElseThrow(() -> new CustomException(CustomErrorCode.ID_NOT_MATCH)); + return userRepository.findById(id).orElseThrow(() -> new CustomException(CustomErrorCode.USER_ID_NOT_MATCH)); } public User updateUser(Long id, SignUpRequest user) { - User findUser = userRepository.findById(id).orElseThrow(() -> new CustomException(CustomErrorCode.ID_NOT_MATCH)); + User findUser = userRepository.findById(id).orElseThrow(() -> new CustomException(CustomErrorCode.USER_ID_NOT_MATCH)); if (user.email() != null) findUser.setEmail(user.email()); if (user.password() != null) findUser.setPassword(user.password()); if (user.name() != null) findUser.setName(user.name()); @@ -54,7 +54,7 @@ public User updateUser(Long id, SignUpRequest user) { } public UserInfo findUserInfo(Long id) { - User user = userRepository.findById(id).orElseThrow(() -> new CustomException(CustomErrorCode.ID_NOT_MATCH)); + User user = userRepository.findById(id).orElseThrow(() -> new CustomException(CustomErrorCode.USER_ID_NOT_MATCH)); List reviews = foodTruckReviewRepository.findByAuthor(user); return new UserInfo(user, reviews); diff --git a/src/test/java/ac/kr/deu/connect/luck/auth/AuthRestControllerTest.java b/src/test/java/ac/kr/deu/connect/luck/auth/AuthRestControllerTest.java index 72ab466..3bbcc17 100644 --- a/src/test/java/ac/kr/deu/connect/luck/auth/AuthRestControllerTest.java +++ b/src/test/java/ac/kr/deu/connect/luck/auth/AuthRestControllerTest.java @@ -203,7 +203,7 @@ void getUserInfoFailure() throws Exception { // then CustomErrorResponse customErrorResponse = objectMapper.readValue(mvcResult.getResponse().getContentAsString(), CustomErrorResponse.class); - CustomErrorCode customErrorCode = CustomErrorCode.ID_NOT_MATCH; + CustomErrorCode customErrorCode = CustomErrorCode.USER_ID_NOT_MATCH; Assertions.assertEquals(customErrorResponse.errorType(), customErrorCode); }