mirror of
https://github.com/C9Glax/tranga.git
synced 2025-10-17 19:00:45 +02:00
Add from, to, filename and metadatafetcher to ActionRecord DTO
This commit is contained in:
@@ -2,6 +2,7 @@ using System.ComponentModel.DataAnnotations;
|
||||
using System.Text.Json.Serialization;
|
||||
using API.Schema.ActionsContext.Actions;
|
||||
using API.Schema.ActionsContext.Actions.Generic;
|
||||
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||
|
||||
namespace API.Controllers.DTOs;
|
||||
|
||||
@@ -11,8 +12,12 @@ public sealed record ActionRecord : Identifiable
|
||||
{
|
||||
Action = actionRecord.Action;
|
||||
PerformedAt = actionRecord.PerformedAt;
|
||||
MangaId = actionRecord is IActionWithMangaRecord m ? m.MangaId : null;
|
||||
ChapterId = actionRecord is IActionWithChapterRecord c ? c.ChapterId : null;
|
||||
MangaId = actionRecord is IActionWithMangaRecord manga ? manga.MangaId : null;
|
||||
ChapterId = actionRecord is IActionWithChapterRecord chapter ? chapter.ChapterId : null;
|
||||
From = actionRecord is DataMovedActionRecord from ? from.From : null;
|
||||
To = actionRecord is DataMovedActionRecord to ? to.To : null;
|
||||
Filename = actionRecord is CoverDownloadedActionRecord filename ? filename.Filename : null;
|
||||
MetadataFetcher = actionRecord is MetadataUpdatedActionRecord metadata ? metadata.MetadataFetcher : null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -38,4 +43,28 @@ public sealed record ActionRecord : Identifiable
|
||||
/// </summary>
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public string? ChapterId { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// FromPath if Record is <see cref="Schema.ActionsContext.Actions.DataMovedActionRecord"/>
|
||||
/// </summary>
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public string? From { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// ToPath if Record is <see cref="Schema.ActionsContext.Actions.DataMovedActionRecord"/>
|
||||
/// </summary>
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public string? To { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Filename if Record is <see cref="Schema.ActionsContext.Actions.CoverDownloadedActionRecord"/>
|
||||
/// </summary>
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public string? Filename { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="Schema.MangaContext.MetadataFetchers.MetadataFetcher"/> if Record is <see cref="Schema.ActionsContext.Actions.MetadataUpdatedActionRecord"/>
|
||||
/// </summary>
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public string? MetadataFetcher { get; init; }
|
||||
}
|
Reference in New Issue
Block a user