Skip to content

Commit

Permalink
Ensure identical timestamps for PageEntity creation
Browse files Browse the repository at this point in the history
Use a single utcNow variable to set both CreateTimeUtc and UpdateTimeUtc properties of PageEntity in CreatePageCommandHandler. This change ensures consistency by assigning the exact same timestamp to both properties.
  • Loading branch information
EdiWang committed Nov 4, 2024
1 parent 0a17a88 commit 840ad3b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Moonglade.Core/PageFeature/CreatePageCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,16 @@ public async Task<Guid> Handle(CreatePageCommand request, CancellationToken ct)
}

var uid = Guid.NewGuid();
var utcNow = DateTime.UtcNow;

var page = new PageEntity
{
Id = uid,
Title = request.Payload.Title.Trim(),
Slug = slug,
MetaDescription = request.Payload.MetaDescription,
CreateTimeUtc = DateTime.UtcNow,
UpdateTimeUtc = DateTime.UtcNow,
CreateTimeUtc = utcNow,
UpdateTimeUtc = utcNow,
HtmlContent = request.Payload.RawHtmlContent,
HideSidebar = request.Payload.HideSidebar,
IsPublished = request.Payload.IsPublished,
Expand Down

0 comments on commit 840ad3b

Please sign in to comment.