namespace Yavsc.Blogspot; /// /// Minimum-viable author payload embedded in . /// /// /// Before this record existed, BlogPostDto.Author was typed /// as the abstract interface IApplicationUser. The /// interface is fine for server-side contract (we have a concrete /// entity that implements it) but System.Text.Json cannot /// materialise an interface without a polymorphic converter /// configured on both ends. PostIt would crash on load-posts /// because the JSON contained an Author object that the /// client could not deserialise. /// /// /// /// This record is the wire shape: Id for "go to author /// profile", UserName for "by @username", Avatar /// for the round badge next to the title. The server-side /// BlogPost entity (Yavsc.Server.Models.Blog) keeps /// its full ApplicationUser navigation property for /// permission checks and authorisation; the DTO is built on /// demand by the controller / service layer when the post is /// served to the wire. /// /// public sealed record BlogPostAuthorDto { public string Id { get; init; } = string.Empty; public string? UserName { get; init; } public string? Avatar { get; init; } }