From dcf0cb38eace795a922c88aed254d3859a6f1dd6 Mon Sep 17 00:00:00 2001 From: "Lee, yeeun" Date: Sat, 23 Nov 2024 17:47:24 +0900 Subject: [PATCH 1/4] =?UTF-8?q?:zap:Feat:=20=EC=9D=B4=EB=AF=B8=EC=A7=80=20?= =?UTF-8?q?=EA=B4=80=EB=A0=A8=20=EB=A1=9C=EC=A7=81=20DTO=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../board/api/dto/request/BoardSaveReqDto.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main/java/univ/yesummit/domain/board/api/dto/request/BoardSaveReqDto.java b/src/main/java/univ/yesummit/domain/board/api/dto/request/BoardSaveReqDto.java index 2e02661..58e8ce1 100644 --- a/src/main/java/univ/yesummit/domain/board/api/dto/request/BoardSaveReqDto.java +++ b/src/main/java/univ/yesummit/domain/board/api/dto/request/BoardSaveReqDto.java @@ -1,6 +1,7 @@ package univ.yesummit.domain.board.api.dto.request; import univ.yesummit.domain.board.domain.Board; +import univ.yesummit.domain.board.domain.BoardPicture; import univ.yesummit.domain.member.entity.Member; import java.util.List; @@ -12,13 +13,26 @@ public record BoardSaveReqDto( String serviceUrl, String PTUrl ) { + public BoardSaveReqDto { + if (imageUrl == null) { + throw new IllegalArgumentException("이미지 URL null"); + } + } public Board toEntity(Member member) { + List boardPictures = imageUrl.stream() + .map(url -> BoardPicture.builder() + .imageUrl(url) + .build()) + .toList(); + return Board.builder() .title(title) .content(content) + .pictures(boardPictures) .writer(member) .serviceUrl(serviceUrl) .PTUrl(PTUrl) .build(); } + } From 48ffe1290d81ae3fe9430481473c7b12cc97adc4 Mon Sep 17 00:00:00 2001 From: "Lee, yeeun" Date: Sat, 23 Nov 2024 17:47:37 +0900 Subject: [PATCH 2/4] =?UTF-8?q?:zap:Feat:=20=EC=9D=B4=EB=AF=B8=EC=A7=80=20?= =?UTF-8?q?=EA=B4=80=EB=A0=A8=20=EB=A1=9C=EC=A7=81=20controller=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/univ/yesummit/domain/board/api/BoardController.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/univ/yesummit/domain/board/api/BoardController.java b/src/main/java/univ/yesummit/domain/board/api/BoardController.java index 1341f0f..3559c26 100644 --- a/src/main/java/univ/yesummit/domain/board/api/BoardController.java +++ b/src/main/java/univ/yesummit/domain/board/api/BoardController.java @@ -14,6 +14,7 @@ import univ.yesummit.domain.board.api.dto.response.BoardInfoResDto; import univ.yesummit.domain.board.application.BoardService; import univ.yesummit.domain.board.domain.Board; +import univ.yesummit.domain.board.domain.BoardPicture; import univ.yesummit.global.resolver.LoginUser; import univ.yesummit.global.resolver.User; @@ -36,7 +37,6 @@ public BoardController(BoardService boardService) { @PostMapping(value= "/summit/{summitId}", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) public ResponseEntity boardSave(@User LoginUser loginUser, @RequestBody BoardSaveReqDto boardSaveReqDto) { - Long boardId = boardService.boardSave(loginUser.getMemberId(), boardSaveReqDto); String message = String.format("%d번 게시글 등록!", boardId); return new ResponseEntity<>(message, HttpStatus.CREATED); @@ -65,7 +65,6 @@ public ResponseEntity boardInfo(@PathVariable(name = "boardId") return new ResponseEntity<>(boardInfo, HttpStatus.OK); } - @Operation(summary = "내가 작성한 PT 영상 게시글 조회", description = "특정 사용자가 작성한 PT 영상 게시글을 조회합니다.") @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "조회 성공"), From 43a6c7833ae320d3757c568ff1595982b374bbaa Mon Sep 17 00:00:00 2001 From: "Lee, yeeun" Date: Sat, 23 Nov 2024 17:47:56 +0900 Subject: [PATCH 3/4] =?UTF-8?q?:zap:Feat:=20=EC=9D=B4=EB=AF=B8=EC=A7=80=20?= =?UTF-8?q?=EA=B4=80=EB=A0=A8=20=EB=A1=9C=EC=A7=81=20service=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/univ/yesummit/domain/board/domain/Board.java | 5 ++--- .../univ/yesummit/domain/board/domain/BoardPicture.java | 8 +++++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main/java/univ/yesummit/domain/board/domain/Board.java b/src/main/java/univ/yesummit/domain/board/domain/Board.java index 045bd8f..f3c4677 100644 --- a/src/main/java/univ/yesummit/domain/board/domain/Board.java +++ b/src/main/java/univ/yesummit/domain/board/domain/Board.java @@ -27,8 +27,6 @@ public class Board { @Schema(description = "피칭 게시글 id", example = "1") private Long boardId; - // 게시글 써밋 아이디 필드 만들기 (숫자만 저장하는 컬럼) - @Schema(description = "피칭 제목", example = "제목") @NotNull(message = "필수 입력 항목입니다.") private String title; @@ -72,9 +70,10 @@ public class Board { private List comments = new ArrayList<>(); @Builder - private Board(String title, String content, String serviceUrl, String PTUrl, Member writer,Long isSummit) { + private Board(String title, String content, String serviceUrl, String PTUrl, Member writer,Long isSummit, List pictures) { this.title = title; this.content = content; + this.pictures = pictures; this.serviceUrl = serviceUrl; this.PTUrl = PTUrl; this.boardDate = String.valueOf(LocalDateTime.now(ZoneId.of("Asia/Seoul"))); diff --git a/src/main/java/univ/yesummit/domain/board/domain/BoardPicture.java b/src/main/java/univ/yesummit/domain/board/domain/BoardPicture.java index 0a6b25e..2f16bfe 100644 --- a/src/main/java/univ/yesummit/domain/board/domain/BoardPicture.java +++ b/src/main/java/univ/yesummit/domain/board/domain/BoardPicture.java @@ -7,6 +7,7 @@ import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; +import univ.yesummit.domain.feed.entity.Feed; @Entity @Getter @@ -27,10 +28,15 @@ public class BoardPicture { @JoinColumn(name = "board_id") private Board board; + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "feed_id") + private Feed feed; + @Builder - private BoardPicture(String imageUrl, Board board) { + private BoardPicture(String imageUrl, Board board, Feed feed) { this.imageUrl = imageUrl; this.board = board; + this.feed = feed; } } \ No newline at end of file From 37d32c94351e5b7d48a55984c280cb590a8e2083 Mon Sep 17 00:00:00 2001 From: sonsumin Date: Sat, 23 Nov 2024 17:59:25 +0900 Subject: [PATCH 4/4] =?UTF-8?q?[#36]=E2=9C=A8Feat:=20=ED=85=8C=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8=EB=A5=BC=20=EC=9C=84=ED=95=9C=20=ED=86=A0=ED=81=B0=20?= =?UTF-8?q?=EC=8B=9C=EA=B0=84=20=EC=A6=9D=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config b/config index a9020d7..66f755c 160000 --- a/config +++ b/config @@ -1 +1 @@ -Subproject commit a9020d7b5d42fa369b56e82c8ac4c67d8974b299 +Subproject commit 66f755ca9d951a2cae3bc84dfa1c296ff4b999e0