26 lines
580 B
C#
26 lines
580 B
C#
using File = T120B165_ImgBoard.Models.File;
|
|
|
|
namespace T120B165_ImgBoard.Dtos.Post;
|
|
|
|
public record PostDto(
|
|
int Id,
|
|
string Title,
|
|
string Description,
|
|
SlimUserDto Author,
|
|
List<Models.Tag> Tags,
|
|
string? FileUrl
|
|
)
|
|
{
|
|
public static PostDto FromPost(Models.Post post, string? fileUrl)
|
|
{
|
|
return new PostDto(
|
|
Id: post.Id,
|
|
Title: post.Title,
|
|
Description: post.Description,
|
|
Author: SlimUserDto.FromUser(post.Author),
|
|
Tags: post.Tags,
|
|
FileUrl: fileUrl
|
|
);
|
|
}
|
|
}
|