mirror of
https://github.com/C9Glax/tranga.git
synced 2025-10-17 10:50: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 System.Text.Json.Serialization;
|
||||||
using API.Schema.ActionsContext.Actions;
|
using API.Schema.ActionsContext.Actions;
|
||||||
using API.Schema.ActionsContext.Actions.Generic;
|
using API.Schema.ActionsContext.Actions.Generic;
|
||||||
|
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||||
|
|
||||||
namespace API.Controllers.DTOs;
|
namespace API.Controllers.DTOs;
|
||||||
|
|
||||||
@@ -11,8 +12,12 @@ public sealed record ActionRecord : Identifiable
|
|||||||
{
|
{
|
||||||
Action = actionRecord.Action;
|
Action = actionRecord.Action;
|
||||||
PerformedAt = actionRecord.PerformedAt;
|
PerformedAt = actionRecord.PerformedAt;
|
||||||
MangaId = actionRecord is IActionWithMangaRecord m ? m.MangaId : null;
|
MangaId = actionRecord is IActionWithMangaRecord manga ? manga.MangaId : null;
|
||||||
ChapterId = actionRecord is IActionWithChapterRecord c ? c.ChapterId : 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>
|
/// <summary>
|
||||||
@@ -38,4 +43,28 @@ public sealed record ActionRecord : Identifiable
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||||
public string? ChapterId { get; init; }
|
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; }
|
||||||
}
|
}
|
@@ -3285,6 +3285,26 @@
|
|||||||
"description": "ChapterId if Record is API.Schema.ActionsContext.Actions.Generic.IActionWithMangaRecord",
|
"description": "ChapterId if Record is API.Schema.ActionsContext.Actions.Generic.IActionWithMangaRecord",
|
||||||
"nullable": true
|
"nullable": true
|
||||||
},
|
},
|
||||||
|
"from": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "FromPath if Record is API.Schema.ActionsContext.Actions.DataMovedActionRecord",
|
||||||
|
"nullable": true
|
||||||
|
},
|
||||||
|
"to": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "ToPath if Record is API.Schema.ActionsContext.Actions.DataMovedActionRecord",
|
||||||
|
"nullable": true
|
||||||
|
},
|
||||||
|
"filename": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Filename if Record is API.Schema.ActionsContext.Actions.CoverDownloadedActionRecord",
|
||||||
|
"nullable": true
|
||||||
|
},
|
||||||
|
"metadataFetcher": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "API.Schema.MangaContext.MetadataFetchers.MetadataFetcher if Record is API.Schema.ActionsContext.Actions.MetadataUpdatedActionRecord",
|
||||||
|
"nullable": true
|
||||||
|
},
|
||||||
"key": {
|
"key": {
|
||||||
"maxLength": 64,
|
"maxLength": 64,
|
||||||
"minLength": 16,
|
"minLength": 16,
|
||||||
|
Reference in New Issue
Block a user