Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup Label="Code Analyzers">
<PackageVersion Include="DiffPlex" Version="1.9.0" />
<PackageVersion Include="IDisposableAnalyzers" Version="4.0.8" />
<GlobalPackageReference Include="SonarAnalyzer.CSharp" Version="10.23.0.137933" PrivateAssets="All" IncludeAssets="Runtime;Build;Native;contentFiles;Analyzers" />
Comment on lines 5 to 8

Copilot AI Apr 24, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DiffPlex is a runtime dependency used by the Web project, but its centrally-managed version was added under the "Code Analyzers" item group. Please move it under the "Web" group to keep package organization consistent with the rest of this file.

Copilot uses AI. Check for mistakes.
</ItemGroup>
Expand Down Expand Up @@ -60,4 +61,4 @@
<ItemGroup Label="Source Code Generators">
<PackageVersion Include="LinkDotNet.Enumeration" Version="1.4.0" />
</ItemGroup>
</Project>
</Project>
59 changes: 59 additions & 0 deletions src/LinkDotNet.Blog.Domain/BlogPostVersion.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;

namespace LinkDotNet.Blog.Domain;

public sealed class BlogPostVersion : Entity
{
public string BlogPostId { get; private set; } = default!;

public int VersionNumber { get; private set; }

public DateTime CreatedAt { get; private set; }

public string Title { get; private set; } = default!;

public string ShortDescription { get; private set; } = default!;

public string Content { get; private set; } = default!;

public string PreviewImageUrl { get; private set; } = default!;

public string? PreviewImageUrlFallback { get; private set; }

public DateTime UpdatedDate { get; private set; }

public IList<string> Tags { get; private set; } = [];

public bool IsPublished { get; private set; }

public int ReadingTimeInMinutes { get; private set; }

public string? AuthorName { get; private set; }

public string TagsAsString => string.Join(",", Tags);

public static BlogPostVersion CreateSnapshot(BlogPost post, int versionNumber)
{
ArgumentNullException.ThrowIfNull(post);

return new BlogPostVersion
{
BlogPostId = post.Id,
VersionNumber = versionNumber,
CreatedAt = DateTime.UtcNow,
Title = post.Title,
ShortDescription = post.ShortDescription,
Content = post.Content,
PreviewImageUrl = post.PreviewImageUrl,
PreviewImageUrlFallback = post.PreviewImageUrlFallback,
UpdatedDate = post.UpdatedDate,
Tags = post.Tags.ToImmutableArray(),
IsPublished = post.IsPublished,
ReadingTimeInMinutes = post.ReadingTimeInMinutes,
AuthorName = post.AuthorName,
};
}
}
Loading