Add project files
This commit is contained in:
25
T120B165-ImgBoard/Dtos/Post/PostDto.cs
Normal file
25
T120B165-ImgBoard/Dtos/Post/PostDto.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
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
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user