diff --git a/src/Web/Features/Contents/Handlers/CreateContent.cs b/src/Web/Features/Contents/Handlers/CreateContent.cs index 999fdd6..8d01e5c 100644 --- a/src/Web/Features/Contents/Handlers/CreateContent.cs +++ b/src/Web/Features/Contents/Handlers/CreateContent.cs @@ -3,6 +3,7 @@ using Hutopy.Application.AzureBlobStorage.Constants; using Hutopy.Application.Common.Interfaces; using Hutopy.Web.Common; using Hutopy.Web.Features.Contents.Data; +using Hutopy.Web.Features.Contents.Handlers.Models; namespace Hutopy.Web.Features.Contents.Handlers; @@ -92,7 +93,28 @@ public sealed class PostContent( await context.SaveChangesAsync(ct); - await SendOkAsync(ct); + var content = await context + .Contents + .Select(c => new ContentModel + { + Id = c.Id, + CreatedBy = c.CreatedBy, + CreatedByName = c.Creator!.Name, + CreatedByPortraitUrl = c.Creator.Images.Logo, + CreatedAt = c.CreatedAt, + ColorMenu = c.Creator.Colors.Menu, + ColorAccent = c.Creator.Colors.Accent, + DeletedBy = c.DeletedBy, + DeletedAt = c.DeletedAt, + Title = c.Title, + Description = c.Description, + Urls = c.Urls, + }) + .SingleOrDefaultAsync( + c => c.Id == req.Id, + cancellationToken: ct); + + await SendOkAsync(content, ct); } private async Task SaveFileAsync(