mirror of
https://github.com/C9Glax/tranga.git
synced 2025-07-03 01:14:17 +02:00
35 lines
1.0 KiB
C#
35 lines
1.0 KiB
C#
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace API.Schema.MangaContext.MetadataFetchers;
|
|
|
|
[PrimaryKey("MetadataFetcherName")]
|
|
public abstract class MetadataFetcher
|
|
{
|
|
// ReSharper disable once EntityFramework.ModelValidation.UnlimitedStringLength
|
|
public string MetadataFetcherName { get; init; }
|
|
|
|
protected MetadataFetcher()
|
|
{
|
|
this.MetadataFetcherName = this.GetType().Name;
|
|
}
|
|
|
|
/// <summary>
|
|
/// EFCORE ONLY!!!
|
|
/// </summary>
|
|
internal MetadataFetcher(string metadataFetcherName)
|
|
{
|
|
this.MetadataFetcherName = metadataFetcherName;
|
|
}
|
|
|
|
internal MetadataEntry CreateMetadataEntry(Manga manga, string identifier) =>
|
|
new (this, manga, identifier);
|
|
|
|
public abstract MetadataSearchResult[] SearchMetadataEntry(Manga manga);
|
|
|
|
public abstract MetadataSearchResult[] SearchMetadataEntry(string searchTerm);
|
|
|
|
/// <summary>
|
|
/// Updates the Manga linked in the MetadataEntry
|
|
/// </summary>
|
|
public abstract void UpdateMetadata(MetadataEntry metadataEntry, MangaContext dbContext);
|
|
} |