diff --git a/src/main/java/space/space_spring/controller/SpaceController.java b/src/main/java/space/space_spring/controller/SpaceController.java index 92363f72..aa5fb9c8 100644 --- a/src/main/java/space/space_spring/controller/SpaceController.java +++ b/src/main/java/space/space_spring/controller/SpaceController.java @@ -9,18 +9,14 @@ import space.space_spring.argument_resolver.jwtLogin.JwtLoginAuth; import space.space_spring.dto.space.GetUserInfoBySpaceResponse; import space.space_spring.dto.space.PostSpaceCreateRequest; -import space.space_spring.dto.space.PostSpaceCreateResponse; -import space.space_spring.entity.UserSpace; import space.space_spring.exception.MultipartFileException; import space.space_spring.exception.SpaceException; import space.space_spring.response.BaseResponse; import space.space_spring.service.S3Uploader; import space.space_spring.service.SpaceService; -import space.space_spring.util.userSpace.UserSpaceUtils; import java.io.IOException; -import java.util.Optional; import static space.space_spring.response.status.BaseExceptionResponseStatus.INVALID_SPACE_CREATE; import static space.space_spring.response.status.BaseExceptionResponseStatus.IS_NOT_IMAGE_FILE; @@ -33,12 +29,11 @@ public class SpaceController { private final SpaceService spaceService; - private final UserSpaceUtils userSpaceUtils; private final S3Uploader s3Uploader; private final String spaceImgDirName = "spaceImg"; @PostMapping("") - public BaseResponse createSpace(@JwtLoginAuth Long userId, @Validated @ModelAttribute PostSpaceCreateRequest postSpaceCreateRequest, BindingResult bindingResult) throws IOException { + public BaseResponse createSpace(@JwtLoginAuth Long userId, @Validated @ModelAttribute PostSpaceCreateRequest postSpaceCreateRequest, BindingResult bindingResult) throws IOException { if (bindingResult.hasErrors()) { throw new SpaceException(INVALID_SPACE_CREATE, getErrorMessage(bindingResult)); } @@ -47,7 +42,9 @@ public BaseResponse createSpace(@JwtLoginAuth Long user String spaceImgUrl = processSpaceImage(postSpaceCreateRequest.getSpaceProfileImg()); // TODO 2. s3에 저장하고 받은 이미지 url 정보와 spaceName 정보로 space create 작업 수행 - return new BaseResponse<>(spaceService.createSpace(userId, postSpaceCreateRequest.getSpaceName(), spaceImgUrl)); + spaceService.createSpace(userId, postSpaceCreateRequest.getSpaceName(), spaceImgUrl); + + return new BaseResponse<>("스페이스 생성 성공"); } private String processSpaceImage(MultipartFile spaceProfileImg) throws IOException { diff --git a/src/main/java/space/space_spring/dto/space/PostSpaceCreateResponse.java b/src/main/java/space/space_spring/dto/space/PostSpaceCreateResponse.java deleted file mode 100644 index bc0c2031..00000000 --- a/src/main/java/space/space_spring/dto/space/PostSpaceCreateResponse.java +++ /dev/null @@ -1,12 +0,0 @@ -package space.space_spring.dto.space; - -import lombok.AllArgsConstructor; -import lombok.Getter; - -@Getter -@AllArgsConstructor -public class PostSpaceCreateResponse { - - private Long spaceId; - private String spaceImgUrl; // 사진 url이 잘 생성됐는지 확인하는 용도 -} diff --git a/src/main/java/space/space_spring/service/SpaceService.java b/src/main/java/space/space_spring/service/SpaceService.java index f17c12f8..6f709d9b 100644 --- a/src/main/java/space/space_spring/service/SpaceService.java +++ b/src/main/java/space/space_spring/service/SpaceService.java @@ -7,14 +7,11 @@ import space.space_spring.dao.UserDao; import space.space_spring.dao.UserSpaceDao; import space.space_spring.dto.space.GetUserInfoBySpaceResponse; -import space.space_spring.dto.space.PostSpaceCreateResponse; import space.space_spring.entity.Space; import space.space_spring.entity.User; -import space.space_spring.dto.space.PostSpaceCreateRequest; import space.space_spring.entity.UserSpace; import space.space_spring.util.space.SpaceUtils; -import java.util.List; @Service @RequiredArgsConstructor @@ -26,7 +23,7 @@ public class SpaceService { private final SpaceUtils spaceUtils; @Transactional - public PostSpaceCreateResponse createSpace(Long userId, String spaceName, String spaceImgUrl) { + public Long createSpace(Long userId, String spaceName, String spaceImgUrl) { // TODO 1. 스페이스 생성 정보 db insert Space saveSpace = spaceDao.saveSpace(spaceName, spaceImgUrl); @@ -35,7 +32,7 @@ public PostSpaceCreateResponse createSpace(Long userId, String spaceName, String User manager = userDao.findUserByUserId(userId); UserSpace userSpace = userSpaceDao.createUserSpace(manager, saveSpace); - return new PostSpaceCreateResponse(saveSpace.getSpaceId(), spaceImgUrl); + return saveSpace.getSpaceId(); } @Transactional