Fix Actions that can have related chapters and manga

This commit is contained in:
2025-10-16 20:28:43 +02:00
parent d029512354
commit ef907ee09d
15 changed files with 75 additions and 49 deletions

View File

@@ -11,8 +11,8 @@ public sealed record ActionRecord : Identifiable
{
Action = actionRecord.Action;
PerformedAt = actionRecord.PerformedAt;
MangaId = actionRecord is ActionWithMangaRecord m ? m.MangaId : null;
ChapterId = actionRecord is ActionWithChapterRecord c ? c.ChapterId : null;
MangaId = actionRecord is IActionWithMangaRecord m ? m.MangaId : null;
ChapterId = actionRecord is IActionWithChapterRecord c ? c.ChapterId : null;
}
/// <summary>
@@ -28,13 +28,13 @@ public sealed record ActionRecord : Identifiable
public DateTime PerformedAt { get; init; }
/// <summary>
/// MangaId if Record is <see cref="ActionWithMangaRecord"/>
/// MangaId if Record is <see cref="IActionWithMangaRecord"/>
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? MangaId { get; init; }
/// <summary>
/// ChapterId if Record is <see cref="ActionWithMangaRecord"/>
/// ChapterId if Record is <see cref="IActionWithMangaRecord"/>
/// </summary>
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? ChapterId { get; init; }