Skip to content

Commit

Permalink
fix: 게시물 상세조회 오류 수정 (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
yongbin97 committed Oct 9, 2024
1 parent 23f5015 commit 83b1fc2
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,23 @@ public PostDetailDto readPostDetailWithTags(Long userId,

List<String> tagList = tagReader.readTagNamesByPostId(postDetailServiceRequest.getPostId());

return PostDetailDto.builder()
.title(postDetail.getTitle())
.content(postDetail.getContent())
.url(postDetail.getUrl())
.tagList(tagList).createdAt(DateTimeManager.convertToStringPattern(
postDetail.getCreatedAt(), "yyyy년 MM월 dd일"))
.memoContent(postDetail.getMemo())
.memoCreatedAt(DateTimeManager.convertToStringPattern(
postDetail.getMemoCreatedAt(), "yy.MM.dd"))
.archiveId(postDetail.getArchive().getId())
.archiveName(postDetail.getArchive().getName())
.build();
PostDetailDto postDetailDto = PostDetailDto.builder()
.title(postDetail.getTitle())
.content(postDetail.getContent())
.url(postDetail.getUrl())
.tagList(tagList)
.createdAt(DateTimeManager.convertToStringPattern(
postDetail.getCreatedAt(),
"yyyy년 MM월 dd일"))
.memoContent(postDetail.getMemo())
.memoCreatedAt(
DateTimeManager.convertToStringPattern(
postDetail.getMemoCreatedAt(),
"yy.MM.dd"))
.build();

postDetailDto.setArchive(postDetail.getArchive());
return postDetailDto;
}

public int readActivatePostCountByUserId(Long userId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.List;
import lombok.Builder;
import lombok.Getter;
import project.backend.entity.archive.Archive;

@Getter
@Builder
Expand All @@ -12,9 +13,16 @@ public class PostDetailDto {
private final String content;
private final String url;
private final List<String> tagList;
private final Long archiveId;
private final String archiveName;
private Long archiveId;
private String archiveName;
private final String createdAt;
private final String memoContent;
private final String memoCreatedAt;

public void setArchive(Archive archive) {
if (archive != null) {
this.archiveId = archive.getId();
this.archiveName = archive.getName();
}
}
}

0 comments on commit 83b1fc2

Please sign in to comment.