-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #149 from TRIP-Side-Project/dev
배포 환경에서의 테스트를 위한 main merge
- Loading branch information
Showing
6 changed files
with
91 additions
and
65 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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
49 changes: 49 additions & 0 deletions
49
...ava/com/api/trip/domain/interestarticle/controller/dto/GetMyInterestArticlesResponse.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,49 @@ | ||
package com.api.trip.domain.interestarticle.controller.dto; | ||
|
||
import com.api.trip.domain.article.model.Article; | ||
import com.api.trip.domain.member.model.Member; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
import java.time.LocalDateTime; | ||
import java.util.List; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
public class GetMyInterestArticlesResponse { | ||
|
||
private List<ArticleDto> articles; | ||
|
||
public static GetMyInterestArticlesResponse of(List<Article> articles) { | ||
List<ArticleDto> articleDtos = articles.stream() | ||
.map(ArticleDto::of) | ||
.toList(); | ||
|
||
return new GetMyInterestArticlesResponse(articleDtos); | ||
} | ||
|
||
@Getter | ||
@Builder | ||
private static class ArticleDto { | ||
|
||
private Long articleId; | ||
private String title; | ||
private Long writerId; | ||
private String writerNickname; | ||
private String writerRole; | ||
private LocalDateTime createdAt; | ||
|
||
private static ArticleDto of(Article article) { | ||
Member writer = article.getWriter(); | ||
return builder() | ||
.articleId(article.getId()) | ||
.title(article.getTitle()) | ||
.writerId(writer.getId()) | ||
.writerNickname(writer.getNickname()) | ||
.writerRole(writer.getRole().name()) | ||
.createdAt(article.getCreatedAt()) | ||
.build(); | ||
} | ||
} | ||
} |
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
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