refactor post reactions
This commit is contained in:
parent
2519fc77d2
commit
5379d29c5f
13 changed files with 129 additions and 97 deletions
|
@ -11,4 +11,16 @@ public record PostDto(
|
|||
IEnumerable<PostReactionDto> Reactions,
|
||||
DateTimeOffset CreatedAt,
|
||||
IEnumerable<string> PossibleReactions
|
||||
);
|
||||
)
|
||||
{
|
||||
public static PostDto FromModel(Modules.Blog.Application.Queries.GetPosts.Dto.PostDto post) =>
|
||||
new(
|
||||
new PostAuthorDto(post.Author.AuthorId, post.Author.Username),
|
||||
post.PostId,
|
||||
post.Text,
|
||||
post.Media.Select(m => new PostMediaDto(m.Url, m.Width, m.Height)),
|
||||
post.Reactions.Select(r => new PostReactionDto(r.Emoji, r.AuthorName, r.ReactedOn)),
|
||||
post.CreatedAt,
|
||||
post.PossibleReactions
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue