Add ActionRecord DTO

Include all Data in ActionRecord return
Add endpoints for returning actions related to manga and chapter
Fix wrong syncs for ActionsContext
This commit is contained in:
2025-10-16 20:08:07 +02:00
parent 6561ba3bc3
commit d029512354
9 changed files with 198 additions and 23 deletions

View File

@@ -1,15 +1,9 @@
using System.ComponentModel.DataAnnotations;
using API.Schema.ActionsContext.Actions.Generic;
using API.Schema.MangaContext;
namespace API.Schema.ActionsContext.Actions;
public sealed class ChapterDownloadedActionRecord(ActionsEnum action, DateTime performedAt, string chapterId) : ActionRecord(action, performedAt)
public sealed class ChapterDownloadedActionRecord(ActionsEnum action, DateTime performedAt, string chapterId) : ActionWithChapterRecord(action, performedAt, chapterId)
{
public ChapterDownloadedActionRecord(Chapter chapter) : this(ActionsEnum.ChapterDownloaded, DateTime.UtcNow, chapter.Key) { }
/// <summary>
/// Chapter that was downloaded
/// </summary>
[StringLength(64)]
public string ChapterId { get; init; } = chapterId;
}

View File

@@ -0,0 +1,15 @@
using System.ComponentModel.DataAnnotations;
using API.Schema.MangaContext;
namespace API.Schema.ActionsContext.Actions.Generic;
public abstract class ActionWithChapterRecord(ActionsEnum action, DateTime performedAt, string chapterId) : ActionRecord(action, performedAt)
{
protected ActionWithChapterRecord(ActionsEnum action, DateTime performedAt, Chapter chapter) : this(action, performedAt, chapter.Key) { }
/// <summary>
/// <see cref="Schema.MangaContext.Manga"/> for which the cover was downloaded
/// </summary>
[StringLength(64)]
public string ChapterId { get; init; } = chapterId;
}

View File

@@ -1,4 +1,5 @@
using API.Schema.ActionsContext.Actions;
using API.Schema.ActionsContext.Actions.Generic;
using Microsoft.EntityFrameworkCore;
namespace API.Schema.ActionsContext;