Skip to content

Commit

Permalink
feat: 작성자 닉네임, 태그 반영
Browse files Browse the repository at this point in the history
  • Loading branch information
1winhyun committed Nov 8, 2024
1 parent 91f5150 commit 2620fd4
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ public class PostResponseDTO {//게시물 생성용

private Long id;//게시물 id

@NotBlank
private String authorNickname;//작성자 닉네임

@NotBlank
private String authorTag;//작성자 태그

@NotBlank
private String content;//내용

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -12,6 +13,12 @@
public class RepostResponseDTO {
private Long id;

@NotBlank
private String authorNickname;//작성자 닉네임

@NotBlank
private String authorTag;//작성자 태그

private String content;

private String imageUrl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 2620fd4

Please sign in to comment.