From 2620fd446cc431b9975509f9f113456e91bf3a37 Mon Sep 17 00:00:00 2001 From: 1winhyun Date: Fri, 8 Nov 2024 12:56:35 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=9E=91=EC=84=B1=EC=9E=90=20=EB=8B=89?= =?UTF-8?q?=EB=84=A4=EC=9E=84,=20=ED=83=9C=EA=B7=B8=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../team2/xclone/domain/post/dto/PostResponseDTO.java | 6 ++++++ .../team2/xclone/domain/post/dto/RepostResponseDTO.java | 7 +++++++ .../team2/xclone/domain/post/service/PostService.java | 7 +++++++ 3 files changed, 20 insertions(+) diff --git a/src/main/java/com/leets/team2/xclone/domain/post/dto/PostResponseDTO.java b/src/main/java/com/leets/team2/xclone/domain/post/dto/PostResponseDTO.java index 20a83a0..43dd211 100644 --- a/src/main/java/com/leets/team2/xclone/domain/post/dto/PostResponseDTO.java +++ b/src/main/java/com/leets/team2/xclone/domain/post/dto/PostResponseDTO.java @@ -16,6 +16,12 @@ public class PostResponseDTO {//게시물 생성용 private Long id;//게시물 id + @NotBlank + private String authorNickname;//작성자 닉네임 + + @NotBlank + private String authorTag;//작성자 태그 + @NotBlank private String content;//내용 diff --git a/src/main/java/com/leets/team2/xclone/domain/post/dto/RepostResponseDTO.java b/src/main/java/com/leets/team2/xclone/domain/post/dto/RepostResponseDTO.java index 608e4b0..4001697 100644 --- a/src/main/java/com/leets/team2/xclone/domain/post/dto/RepostResponseDTO.java +++ b/src/main/java/com/leets/team2/xclone/domain/post/dto/RepostResponseDTO.java @@ -1,5 +1,6 @@ package com.leets.team2.xclone.domain.post.dto; +import jakarta.validation.constraints.NotBlank; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -12,6 +13,12 @@ public class RepostResponseDTO { private Long id; + @NotBlank + private String authorNickname;//작성자 닉네임 + + @NotBlank + private String authorTag;//작성자 태그 + private String content; private String imageUrl; diff --git a/src/main/java/com/leets/team2/xclone/domain/post/service/PostService.java b/src/main/java/com/leets/team2/xclone/domain/post/service/PostService.java index c442662..49089a4 100644 --- a/src/main/java/com/leets/team2/xclone/domain/post/service/PostService.java +++ b/src/main/java/com/leets/team2/xclone/domain/post/service/PostService.java @@ -127,13 +127,20 @@ public PostResponseDTO toPostResponseDTO(Post post){//자식 게시물 리스트 if(post.getQuotePost()!=null){ repostResponseDTO=RepostResponseDTO.builder() .id(post.getQuotePost().getId()) + .authorNickname(post.getQuotePost().getAuthor().getNickname()) + .authorTag(post.getQuotePost().getAuthor().getTag()) .content(post.getQuotePost().getContent()) .imageUrl(post.getQuotePost().getImageUrl()) .build(); }//인용한 게시물 가져오기 + String authorNickname=post.getAuthor().getNickname(); + String authorTag=post.getAuthor().getTag(); + return new PostResponseDTO( post.getId(), + authorNickname, + authorTag, post.getContent(), post.getImageUrl(), post.getParentPost() != null ? post.getParentPost().getId() : null,