diff --git a/src/main/java/shop/cazait/domain/cafe/api/CafeController.java b/src/main/java/shop/cazait/domain/cafe/api/CafeController.java index 2d2fb093..21a02950 100644 --- a/src/main/java/shop/cazait/domain/cafe/api/CafeController.java +++ b/src/main/java/shop/cazait/domain/cafe/api/CafeController.java @@ -1,9 +1,6 @@ package shop.cazait.domain.cafe.api; import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; @@ -34,18 +31,14 @@ public class CafeController { private final CafeService cafeService; - @PostMapping(value = "/add/master/{masterId}", consumes = {MediaType.APPLICATION_JSON_VALUE, MediaType.MULTIPART_FORM_DATA_VALUE}) + @PostMapping(value = "/add/master/{masterId}", consumes = {MediaType.MULTIPART_FORM_DATA_VALUE}) @ApiOperation(value = "카페 등록", notes = "master가 카페를 등록한다.") @ApiImplicitParam(name = "masterId", value = "마스터 ID") public SuccessResponse addCafe(@PathVariable Long masterId, - @RequestParam String json, - @RequestPart(value = "cafeImages", required = false) List cafeImage) throws JsonProcessingException { - - ObjectMapper objectMapper = new ObjectMapper().registerModule(new JavaTimeModule()); - PostCafeReq postCafeReq = objectMapper.readValue(json, new TypeReference<>() {}); - cafeService.addCafe(masterId, postCafeReq, cafeImage); + @RequestPart @Valid PostCafeReq postCafeReq, + @RequestPart(required = false) List imageFiles) throws JsonProcessingException { + cafeService.addCafe(masterId, postCafeReq, imageFiles); return new SuccessResponse<>("카페 등록 완료"); - } @GetMapping("/all/user/{userId}")