diff --git a/src/main/java/com/umc/hackaton/snapspot/spot/controller/SpotController.java b/src/main/java/com/umc/hackaton/snapspot/spot/controller/SpotController.java index 5dce3d8..080568c 100644 --- a/src/main/java/com/umc/hackaton/snapspot/spot/controller/SpotController.java +++ b/src/main/java/com/umc/hackaton/snapspot/spot/controller/SpotController.java @@ -22,8 +22,8 @@ public class SpotController { @PostMapping public ResponseEntity upload(@RequestBody SpotRequestDto dto) { try { - spotService.upload(dto); - return ResponseEntity.ok().body("스팟 업로드 성공."); + Spot spot = spotService.upload(dto); + return ResponseEntity.ok().body(spot); } catch (Exception e) { return ResponseEntity.status(HttpStatus.BAD_REQUEST).body("스팟 업로드에 실패하였습니다."); } diff --git a/src/main/java/com/umc/hackaton/snapspot/spot/service/SpotService.java b/src/main/java/com/umc/hackaton/snapspot/spot/service/SpotService.java index bbe8098..a27e928 100644 --- a/src/main/java/com/umc/hackaton/snapspot/spot/service/SpotService.java +++ b/src/main/java/com/umc/hackaton/snapspot/spot/service/SpotService.java @@ -27,7 +27,7 @@ public class SpotService { private final CategorySpotRepository categorySpotRepository; @Transactional - public void upload(SpotRequestDto dto) { + public Spot upload(SpotRequestDto dto) { User user = userRepository.findUserById(dto.getUserId()); @@ -55,7 +55,7 @@ public void upload(SpotRequestDto dto) { // CategorySpot 저장 categorySpotRepository.saveAll(categorySpots); - + return savedSpot; } @Transactional