diff --git a/src/main/java/com/dailylife/domain/board/dto/BoardCreateRequest.java b/src/main/java/com/dailylife/domain/board/dto/BoardCreateRequest.java index 0f279fa..f46c07b 100644 --- a/src/main/java/com/dailylife/domain/board/dto/BoardCreateRequest.java +++ b/src/main/java/com/dailylife/domain/board/dto/BoardCreateRequest.java @@ -31,6 +31,4 @@ public class BoardCreateRequest { private MultipartFile[] imageName; - - } diff --git a/src/main/java/com/dailylife/domain/follow/controller/FollowingController.java b/src/main/java/com/dailylife/domain/follow/controller/FollowingController.java index 84c5370..beb9697 100644 --- a/src/main/java/com/dailylife/domain/follow/controller/FollowingController.java +++ b/src/main/java/com/dailylife/domain/follow/controller/FollowingController.java @@ -3,9 +3,11 @@ import com.dailylife.domain.follow.dto.FollowingRequest; import com.dailylife.domain.follow.entity.Follow; import com.dailylife.domain.follow.service.FollowingService; +import com.dailylife.global.dto.ApplicationResponse; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -44,9 +46,9 @@ public ResponseEntity> getFollower() { @ApiOperation(value = "팔로우를 확인합니다", notes = "팔로우를 확인합니다.") @PostMapping("/getFollow") - public String getFollow() { - followingService.getFollow(); - return null; + public ApplicationResponse> getFollow() { + List follow = followingService.getFollow(); + return ApplicationResponse.create("팔로워를 불러왔습니다" , HttpStatus.CREATED , follow); } } diff --git a/src/main/java/com/dailylife/global/fileUpload/ImageRemove.java b/src/main/java/com/dailylife/global/fileUpload/ImageRemove.java index de4f916..52b0bc4 100644 --- a/src/main/java/com/dailylife/global/fileUpload/ImageRemove.java +++ b/src/main/java/com/dailylife/global/fileUpload/ImageRemove.java @@ -1,5 +1,6 @@ package com.dailylife.global.fileUpload; +import com.dailylife.global.fileUpload.exception.NotFoundFileException; import org.springframework.stereotype.Component; import java.io.File; @@ -9,20 +10,15 @@ public class ImageRemove { public void deleteFile(String fileName) { // 파일의 경로 + 파일명 - String filePath = "C:\\dailylife_server3\\src\\main\\resources\\images\\"+fileName; // 우선 절대경로 설정 - +// String filePath = "C:\\dailylife_server3\\src\\main\\resources\\images\\"+fileName; // 우선 절대경로 설정 + String filePath = "/home/ubuntu/images/"+fileName; // File deleteFile = new File(filePath); - // 파일이 존재하는지 체크 존재할경우 true, 존재하지않을경우 false if(deleteFile.exists()) { - - // 파일을 삭제합니다. deleteFile.delete(); - - System.out.println("파일을 삭제하였습니다."); - + throw new NotFoundFileException(); } else { - System.out.println("파일이 존재하지 않습니다."); + throw new NotFoundFileException(); } } } diff --git a/src/main/java/com/dailylife/global/fileUpload/MultiUpload.java b/src/main/java/com/dailylife/global/fileUpload/MultiUpload.java index 8c4830b..4a89118 100644 --- a/src/main/java/com/dailylife/global/fileUpload/MultiUpload.java +++ b/src/main/java/com/dailylife/global/fileUpload/MultiUpload.java @@ -15,7 +15,7 @@ @Log4j2 public class MultiUpload { public List FileUpload(MultipartFile[] file) throws IOException { - String uploadPath = "/images"; // 우선 절대경로 설정 + String uploadPath = "/home/ubuntu/images"; // 우선 절대경로 설정 // String uploadPath = "C:\\Users\\sdm03\\OneDrive\\바탕 화면\\dailylife (1)\\dailylife_server3\\src\\main\\resources\\images"; ArrayList fileName = new ArrayList<>(); // 파일 이름들을 저장할 리스트 생성 @@ -40,7 +40,6 @@ public List FileUpload(MultipartFile[] file) throws IOException { file[i].transferTo(target); fileName.add(saveFileName); // 리스트에 파일이름 갯수만큼 저장 - } return fileName; // 리스트 리턴 } diff --git a/src/main/java/com/dailylife/global/fileUpload/exception/NotExistFileException.java b/src/main/java/com/dailylife/global/fileUpload/exception/NotExistFileException.java new file mode 100644 index 0000000..aee96d8 --- /dev/null +++ b/src/main/java/com/dailylife/global/fileUpload/exception/NotExistFileException.java @@ -0,0 +1,9 @@ +package com.dailylife.global.fileUpload.exception; + +import com.dailylife.global.exception.ApplicationException; + +public class NotExistFileException extends ApplicationException { + public NotExistFileException() { + super(302, "파일이 존재하지 않습니다."); + } +} diff --git a/src/main/java/com/dailylife/global/fileUpload/exception/NotFoundFileException.java b/src/main/java/com/dailylife/global/fileUpload/exception/NotFoundFileException.java new file mode 100644 index 0000000..9e4cf2c --- /dev/null +++ b/src/main/java/com/dailylife/global/fileUpload/exception/NotFoundFileException.java @@ -0,0 +1,10 @@ +package com.dailylife.global.fileUpload.exception; + +import com.dailylife.global.exception.ApplicationException; + +public class NotFoundFileException extends ApplicationException { + + public NotFoundFileException() { + super(301, "파일을 찾을수 없습니다."); + } +} diff --git a/src/main/java/com/dailylife/global/init/InitDB.java b/src/main/java/com/dailylife/global/init/InitDB.java index cdf4300..11da776 100644 --- a/src/main/java/com/dailylife/global/init/InitDB.java +++ b/src/main/java/com/dailylife/global/init/InitDB.java @@ -28,7 +28,7 @@ public void initDB() throws IOException { if(ddlAutoConfig.equals("create")){ UserJoinRequest userReq1 = UserJoinRequest.builder() - .userId("d1") + .userId("dl1") .userPassword("dl") .userName("dailyLife") .userEmail("dailyLife.dev@gmail.com").userJoinDate(LocalDateTime.now()).build(); diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index e9a947d..4536416 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,9 +1,9 @@ spring: datasource: driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://146.56.39.196:3306/dailylife?useUnicode=yes&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=Asia/Seoul - username: dailylife - password: 1234 + url: jdbc:mysql://localhost:3306/jpashop?useUnicode=yes&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=Asia/Seoul + username: sa + password: km971gb5!! mvc: pathmatch: