Adds Name and LogoUrl for CreatedBy Content

This commit is contained in:
Jonathan Bourdon
2024-08-07 03:10:10 -04:00
parent 6d9201e8aa
commit f3b225d3a8
2 changed files with 33 additions and 3 deletions

View 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);
}