-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3fe998a
commit 2f84312
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
module-domain/src/main/java/com/mile/post/service/dto/PostGetResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
); | ||
} | ||
} |