mirror of
https://github.com/C9Glax/tranga.git
synced 2025-10-17 10:50:45 +02:00
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using API.Schema.MangaContext;
|
||||
|
||||
namespace API.Schema.ActionsContext.Actions;
|
||||
|
||||
public sealed class ChapterDownloadedActionRecord(string action, DateTime performedAt, string chapterId) : ActionRecord(action, performedAt)
|
||||
{
|
||||
public ChapterDownloadedActionRecord(Chapter chapter) : this(ChapterDownloadedAction, DateTime.UtcNow, chapter.Key) { }
|
||||
|
||||
/// <summary>
|
||||
/// Chapter that was downloaded
|
||||
/// </summary>
|
||||
[StringLength(64)]
|
||||
public string ChapterId { get; init; } = chapterId;
|
||||
|
||||
public const string ChapterDownloadedAction = "Chapter.Downloaded";
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
using API.Schema.ActionsContext.Actions.Generic;
|
||||
using API.Schema.MangaContext;
|
||||
|
||||
namespace API.Schema.ActionsContext.Actions;
|
||||
|
||||
public sealed class ChaptersRetrievedActionRecord(string action, DateTime performedAt, string mangaId)
|
||||
: ActionWithMangaRecord(action, performedAt, mangaId)
|
||||
{
|
||||
public ChaptersRetrievedActionRecord(Manga manga) : this(ChaptersRetrievedAction, DateTime.UtcNow, manga.Key) { }
|
||||
|
||||
public const string ChaptersRetrievedAction = "Manga.ChaptersRetrieved";
|
||||
}
|
@@ -0,0 +1,19 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using API.Schema.ActionsContext.Actions.Generic;
|
||||
using API.Schema.MangaContext;
|
||||
|
||||
namespace API.Schema.ActionsContext.Actions;
|
||||
|
||||
public sealed class CoverDownloadedActionRecord(string action, DateTime performedAt, string mangaId, string filename)
|
||||
: ActionWithMangaRecord(action, performedAt, mangaId)
|
||||
{
|
||||
public CoverDownloadedActionRecord(Manga manga, string filename) : this(CoverDownloadedAction, DateTime.UtcNow, manga.Key, filename) { }
|
||||
|
||||
/// <summary>
|
||||
/// Filename on disk
|
||||
/// </summary>
|
||||
[StringLength(1024)]
|
||||
public string Filename { get; init; } = filename;
|
||||
|
||||
public const string CoverDownloadedAction = "Manga.CoverDownloaded";
|
||||
}
|
22
API/Schema/ActionsContext/Actions/DataMovedActionRecord.cs
Normal file
22
API/Schema/ActionsContext/Actions/DataMovedActionRecord.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace API.Schema.ActionsContext.Actions;
|
||||
|
||||
public sealed class DataMovedActionRecord(string action, DateTime performedAt, string from, string to) : ActionRecord(action, performedAt)
|
||||
{
|
||||
public DataMovedActionRecord(string from, string to) : this(DataMovedAction, DateTime.UtcNow, from, to) { }
|
||||
|
||||
/// <summary>
|
||||
/// From path
|
||||
/// </summary>
|
||||
[StringLength(2048)]
|
||||
public string From { get; init; } = from;
|
||||
|
||||
/// <summary>
|
||||
/// To path
|
||||
/// </summary>
|
||||
[StringLength(2048)]
|
||||
public string To { get; init; } = to;
|
||||
|
||||
public const string DataMovedAction = "Tranga.DataMoved";
|
||||
}
|
@@ -0,0 +1,15 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using API.Schema.MangaContext;
|
||||
|
||||
namespace API.Schema.ActionsContext.Actions.Generic;
|
||||
|
||||
public abstract class ActionWithMangaRecord(string action, DateTime performedAt, string mangaId) : ActionRecord(action, performedAt)
|
||||
{
|
||||
protected ActionWithMangaRecord(string action, DateTime performedAt, Manga manga) : this(action, performedAt, manga.Key) { }
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="Schema.MangaContext.Manga"/> for which the cover was downloaded
|
||||
/// </summary>
|
||||
[StringLength(64)]
|
||||
public string MangaId { get; init; } = mangaId;
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using API.Schema.ActionsContext.Actions.Generic;
|
||||
using API.Schema.MangaContext;
|
||||
|
||||
namespace API.Schema.ActionsContext.Actions;
|
||||
|
||||
public sealed class LibraryMovedActionRecord(string action, DateTime performedAt, string mangaId, string fileLibraryId) : ActionWithMangaRecord(action, performedAt, mangaId)
|
||||
{
|
||||
public LibraryMovedActionRecord(Manga manga, FileLibrary library) : this(LibraryMovedAction, DateTime.UtcNow, manga.Key, library.Key) { }
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="Schema.MangaContext.FileLibrary"/> for which the cover was downloaded
|
||||
/// </summary>
|
||||
[StringLength(64)]
|
||||
public string FileLibraryId { get; init; } = fileLibraryId;
|
||||
|
||||
public const string LibraryMovedAction = "Manga.LibraryMoved";
|
||||
}
|
@@ -0,0 +1,20 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using API.Schema.ActionsContext.Actions.Generic;
|
||||
using API.Schema.MangaContext;
|
||||
using API.Schema.MangaContext.MetadataFetchers;
|
||||
|
||||
namespace API.Schema.ActionsContext.Actions;
|
||||
|
||||
public sealed class MetadataUpdatedActionRecord(string action, DateTime performedAt, string mangaId, string metadataFetcher)
|
||||
: ActionWithMangaRecord(action, performedAt, mangaId)
|
||||
{
|
||||
public MetadataUpdatedActionRecord(Manga manga, MetadataFetcher fetcher) : this(MetadataUpdatedAction, DateTime.UtcNow, manga.Key, fetcher.Name) { }
|
||||
|
||||
/// <summary>
|
||||
/// Filename on disk
|
||||
/// </summary>
|
||||
[StringLength(1024)]
|
||||
public string MetadataFetcher { get; init; } = metadataFetcher;
|
||||
|
||||
public const string MetadataUpdatedAction = "Manga.MetadataUpdated";
|
||||
}
|
8
API/Schema/ActionsContext/Actions/StartupActionRecord.cs
Normal file
8
API/Schema/ActionsContext/Actions/StartupActionRecord.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace API.Schema.ActionsContext.Actions;
|
||||
|
||||
public sealed class StartupActionRecord(string action, DateTime performedAt) : ActionRecord(action, performedAt)
|
||||
{
|
||||
public StartupActionRecord() : this(StartupAction, DateTime.UtcNow) { }
|
||||
|
||||
public const string StartupAction = "Tranga.Started";
|
||||
}
|
Reference in New Issue
Block a user