Adds Name and LogoUrl for CreatedBy Content
This commit is contained in:
26
src/Web/Features/Contents/Handlers/Models/ContentModel.cs
Normal file
26
src/Web/Features/Contents/Handlers/Models/ContentModel.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using Hutopy.Web.Features.Contents.Data;
|
||||
|
||||
namespace Hutopy.Web.Features.Contents.Handlers.Models;
|
||||
|
||||
public record struct ContentModel(
|
||||
Guid Id,
|
||||
Guid CreatedBy,
|
||||
string CreatedByName,
|
||||
string? CreatedByPortraitUrl,
|
||||
DateTimeOffset CreatedAt,
|
||||
string Title,
|
||||
string Description,
|
||||
string[]? Urls);
|
||||
|
||||
public static class ContentExtensions
|
||||
{
|
||||
public static ContentModel ToResponse(this Content c) => new(
|
||||
c.Id,
|
||||
c.CreatedBy,
|
||||
c.Creator!.Name,
|
||||
c.Creator.Images.Logo,
|
||||
c.CreatedAt,
|
||||
c.Title,
|
||||
c.Description,
|
||||
c.Urls);
|
||||
}
|
||||
Reference in New Issue
Block a user