Optimize post categories, tags usage counting

This commit is contained in:
2025-08-21 23:22:59 +08:00
parent d92220b4bc
commit c1c17b5f4e
2 changed files with 40 additions and 5 deletions

View File

@@ -97,6 +97,8 @@ public class PostTag : ModelBase
[MaxLength(128)] public string Slug { get; set; } = null!;
[MaxLength(256)] public string? Name { get; set; }
[JsonIgnore] public ICollection<Post> Posts { get; set; } = new List<Post>();
[NotMapped] public int? Usage { get; set; }
}
public class PostCategory : ModelBase
@@ -105,6 +107,8 @@ public class PostCategory : ModelBase
[MaxLength(128)] public string Slug { get; set; } = null!;
[MaxLength(256)] public string? Name { get; set; }
[JsonIgnore] public ICollection<Post> Posts { get; set; } = new List<Post>();
[NotMapped] public int? Usage { get; set; }
}
public class PostCollection : ModelBase