diff --git a/server/src/main/java/com/yogit/server/board/dto/request/CreateBoardReq.java b/server/src/main/java/com/yogit/server/board/dto/request/CreateBoardReq.java index fbe0712..3cc3a74 100644 --- a/server/src/main/java/com/yogit/server/board/dto/request/CreateBoardReq.java +++ b/server/src/main/java/com/yogit/server/board/dto/request/CreateBoardReq.java @@ -76,7 +76,7 @@ public class CreateBoardReq { @ApiParam(value = "그룹 카테고리 ID", required = true) private Long categoryId; - @ApiModelProperty(example = "예시 구하면 추가 할 예정입니다.") + @ApiModelProperty(example = "\"https://yogit.s3.ap-northeast-2.amazonaws.com/boardimguuid2\"") @ApiParam(value = "게시글 이미지 데이터", required = false) private List images; // 최대 5개 diff --git a/server/src/main/java/com/yogit/server/board/dto/request/PatchBoardReq.java b/server/src/main/java/com/yogit/server/board/dto/request/PatchBoardReq.java index ea4c5d5..fd44e73 100644 --- a/server/src/main/java/com/yogit/server/board/dto/request/PatchBoardReq.java +++ b/server/src/main/java/com/yogit/server/board/dto/request/PatchBoardReq.java @@ -5,10 +5,12 @@ import io.swagger.annotations.ApiParam; import lombok.Data; import lombok.NoArgsConstructor; +import org.springframework.web.multipart.MultipartFile; import javax.validation.constraints.NotBlank; import javax.validation.constraints.Size; import java.time.LocalDateTime; +import java.util.List; @Data @NoArgsConstructor @@ -72,4 +74,8 @@ public class PatchBoardReq { @ApiModelProperty(example = "1") @ApiParam(value = "그룹 카테고리 ID", required = false) private Long categoryId; + + @ApiModelProperty(example = "\"https://yogit.s3.ap-northeast-2.amazonaws.com/boardimguuid2\"") + @ApiParam(value = "게시글 이미지 데이터", required = false) + private List images; // 최대 5개 } diff --git a/server/src/main/java/com/yogit/server/board/service/BoardServiceImpl.java b/server/src/main/java/com/yogit/server/board/service/BoardServiceImpl.java index 4036257..d22d9bc 100644 --- a/server/src/main/java/com/yogit/server/board/service/BoardServiceImpl.java +++ b/server/src/main/java/com/yogit/server/board/service/BoardServiceImpl.java @@ -110,6 +110,16 @@ public ApplicationResponse updateBoard(PatchBoardReq dto){ } board.updateBoard(dto, city, category); + + //BoardImages aws s3에 저장 후 리파지토리에도 저장 + if(!dto.getImages().isEmpty()){ + List imageUUids = awsS3Service.uploadImages(dto.getImages()); + for(String i : imageUUids){ + BoardImage boardImage = new BoardImage(board, i); + boardImageRepository.save(boardImage); + imageUrls.add(awsS3Service.makeUrlOfFilename(i)); + } + } BoardRes boardRes = BoardRes.toDto(board, imageUrls); return ApplicationResponse.ok(boardRes); }