Skip to content

Commit

Permalink
#66 [feat] 글 조회 DTO 생성
Browse files Browse the repository at this point in the history
  • Loading branch information
parkheeddong committed Jan 11, 2024
1 parent 3fe998a commit 2f84312
Showing 1 changed file with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.mile.post.service.dto;

import com.mile.moim.domain.Moim;
import com.mile.post.domain.Post;
import com.mile.utils.DateUtil;
import com.mile.writerName.domain.WriterName;

public record PostGetResponse(
String topic,
String createdAt,
String title,
String content,
String imageUrl,
String writerName,
String moimName,
String writerInfo
) {
public static PostGetResponse of(Post post, Moim moim) {
return new PostGetResponse(
post.getTopic().getContent(),
DateUtil.getKoreanStringOfLocalDate(post.getCreatedAt()),
post.getTitle(),
post.getContent(),
post.getImageUrl(),
post.getWriterName().getName(),
moim.getName(),
post.getWriterName().getInformation()
);
}
}

0 comments on commit 2f84312

Please sign in to comment.