Moved relevant application layer enums and value objects to the domain layer.

This commit is contained in:
2025-11-01 01:19:34 -04:00
parent 4121bd94d9
commit 14129a8bba
48 changed files with 255 additions and 162 deletions

View File

@@ -1,7 +1,7 @@
namespace JSMR.Application.Common;
public interface ISupportedLanguage
{
string Code { get; }
Language Language { get; }
}
//public interface ISupportedLanguage
//{
// string Code { get; }
// Language Language { get; }
//}

View File

@@ -1,4 +1,4 @@
namespace JSMR.Application.Common;
namespace JSMR.Application.Enums;
public enum Locale
{

View File

@@ -1,4 +1,5 @@
using JSMR.Application.Common;
using JSMR.Domain.Enums;
using JSMR.Domain.ValueObjects;
namespace JSMR.Application.Integrations.DLSite.Models;
@@ -10,7 +11,7 @@ public class VoiceWorkDetails
public int WishlistCount { get; init; }
public int DownloadCount { get; init; }
public DateTime? RegistrationDate { get; init; }
public ISupportedLanguage[] SupportedLanguages { get; init; } = [];
public SupportedLanguage[] SupportedLanguages { get; init; } = [];
public AIGeneration AI { get; init; }
public bool HasTrial { get; init; }
public bool HasDLPlay { get; init; }

View File

@@ -1,4 +1,4 @@
using JSMR.Application.Common;
using JSMR.Domain.Enums;
namespace JSMR.Application.Integrations.DLSite.Models;
@@ -6,5 +6,6 @@ public class VoiceWorkTranslation
{
public required string OriginalProductId { get; init; }
public bool IsOfficialTranslation { get; init; }
public bool IsRecommendedTranslation { get; init; }
public required Language Language { get; init; }
}

View File

@@ -15,4 +15,8 @@
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.10" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\JSMR.Domain\JSMR.Domain.csproj" />
</ItemGroup>
</Project>

View File

@@ -1,4 +1,4 @@
using JSMR.Application.Common;
using JSMR.Domain.Enums;
namespace JSMR.Application.Scanning.Contracts;

View File

@@ -1,5 +1,6 @@
using JSMR.Application.Common;
using JSMR.Application.Integrations.DLSite.Models;
using JSMR.Application.Integrations.DLSite.Models;
using JSMR.Domain.Enums;
using JSMR.Domain.ValueObjects;
namespace JSMR.Application.Scanning.Contracts;
@@ -20,10 +21,13 @@ public sealed record VoiceWorkIngest
public int? Votes { get; init; }
public AgeRating AgeRating { get; init; }
public bool HasImage { get; init; }
public ICollection<ISupportedLanguage> SupportedLanguages { get; init; } = [];
public ICollection<SupportedLanguage> SupportedLanguages { get; init; } = [];
public DateOnly? ExpectedDate { get; init; }
public DateOnly? SalesDate { get; init; }
public DateTime? RegistrationDate { get; init; }
public AIGeneration AI { get; init; }
public VoiceWorkSeries? Series { get; init; }
public VoiceWorkTranslation? Translation { get; init; }
public static VoiceWorkIngest From(DLSiteWork work, VoiceWorkDetails? details)
{
@@ -47,7 +51,10 @@ public sealed record VoiceWorkIngest
SupportedLanguages = details?.SupportedLanguages ?? [],
ExpectedDate = work.ExpectedDate,
SalesDate = work.SalesDate,
RegistrationDate = details?.RegistrationDate
RegistrationDate = details?.RegistrationDate,
AI = details?.AI ?? AIGeneration.None,
Series = details?.Series,
Translation = details?.Translation
};
}
}

View File

@@ -1,4 +1,4 @@
using JSMR.Application.Common;
using JSMR.Application.Enums;
namespace JSMR.Application.Scanning;

View File

@@ -1,4 +1,5 @@
using JSMR.Application.Common;
using JSMR.Application.Enums;
using JSMR.Domain.Enums;
namespace JSMR.Application.VoiceWorks.Queries.Search;

View File

@@ -1,4 +1,4 @@
using JSMR.Application.Common;
using JSMR.Domain.Enums;
namespace JSMR.Application.VoiceWorks.Queries.Search;

View File

@@ -1,4 +1,4 @@
namespace JSMR.Application.Common;
namespace JSMR.Domain.Enums;
public enum AIGeneration
{

View File

@@ -1,4 +1,4 @@
namespace JSMR.Application.Common;
namespace JSMR.Domain.Enums;
public enum AgeRating
{

View File

@@ -1,4 +1,4 @@
namespace JSMR.Application.Common;
namespace JSMR.Domain.Enums;
public enum Language
{

View File

@@ -1,4 +1,4 @@
namespace JSMR.Application.Common;
namespace JSMR.Domain.Enums;
public enum VoiceWorkStatus
{

View File

@@ -0,0 +1,39 @@
using JSMR.Domain.Enums;
namespace JSMR.Domain.ValueObjects;
public sealed record SupportedLanguage(string Code, Language Language)
{
public static readonly SupportedLanguage Japanese = new("JPN", Language.Japanese);
public static readonly SupportedLanguage English = new("ENG", Language.English);
public static readonly SupportedLanguage ChineseSimplified = new("CHI_HANS", Language.ChineseSimplified);
public static readonly SupportedLanguage ChineseTraditional = new("CHI_HANT", Language.ChineseTraditional);
public static readonly SupportedLanguage Korean = new("KO_KR", Language.Korean);
public static readonly SupportedLanguage Alingual = new("NM", Language.Unknown);
public static IReadOnlyList<SupportedLanguage> All =>
[
Japanese,
English,
ChineseSimplified,
ChineseTraditional,
Korean
];
private static readonly Dictionary<string, SupportedLanguage> _byCode =
All.ToDictionary(x => x.Code, StringComparer.OrdinalIgnoreCase);
private static readonly Dictionary<Language, SupportedLanguage> _byLang =
All.ToDictionary(x => x.Language);
public static bool TryFromCode(string code, out SupportedLanguage? supportedLanguage) =>
_byCode.TryGetValue(code, out supportedLanguage);
public static bool TryFromLanguage(Language lang, out SupportedLanguage? supportedLanguage) =>
_byLang.TryGetValue(lang, out supportedLanguage);
public static SupportedLanguage FromLanguage(Language language) =>
_byLang.TryGetValue(language, out var sl)
? sl
: throw new ArgumentOutOfRangeException(nameof(language), $"Unsupported: {language}");
}

View File

@@ -1,4 +1,4 @@
using JSMR.Application.Common;
using JSMR.Domain.Enums;
namespace JSMR.Infrastructure.Common.Languages;

View File

@@ -1,4 +1,4 @@
using JSMR.Application.Common;
using JSMR.Domain.Enums;
using NTextCat;
using System.Reflection;

View File

@@ -2,8 +2,8 @@
namespace JSMR.Infrastructure.Common.SupportedLanguages;
public class AlingualLanguage : ISupportedLanguage
{
public Language Language => Language.Unknown;
public string Code => "NM";
}
//public class AlingualLanguage : ISupportedLanguage
//{
// public Language Language => Language.Unknown;
// public string Code => "NM";
//}

View File

@@ -2,8 +2,8 @@
namespace JSMR.Infrastructure.Common.SupportedLanguages;
public class ChineseLanguage : ISupportedLanguage
{
public Language Language => Language.ChineseTraditional; // ???
public string Code => "CHI";
}
//public class ChineseLanguage : ISupportedLanguage
//{
// public Language Language => Language.ChineseTraditional; // ???
// public string Code => "CHI";
//}

View File

@@ -2,8 +2,8 @@
namespace JSMR.Infrastructure.Common.SupportedLanguages;
public class DLSiteOfficialTranslationLanguage : ISupportedLanguage
{
public string Code => "DOT";
public Language Language => Language.Unknown;
}
//public class DLSiteOfficialTranslationLanguage : ISupportedLanguage
//{
// public string Code => "DOT";
// public Language Language => Language.Unknown;
//}

View File

@@ -2,8 +2,8 @@
namespace JSMR.Infrastructure.Common.SupportedLanguages;
public class EnglishLanguage : ISupportedLanguage
{
public Language Language => Language.English;
public string Code => "ENG";
}
//public class EnglishLanguage : ISupportedLanguage
//{
// public Language Language => Language.English;
// public string Code => "ENG";
//}

View File

@@ -2,8 +2,8 @@
namespace JSMR.Infrastructure.Common.SupportedLanguages;
public class JapaneseLanguage : ISupportedLanguage
{
public Language Language => Language.Japanese;
public string Code => "JPN";
}
//public class JapaneseLanguage : ISupportedLanguage
//{
// public Language Language => Language.Japanese;
// public string Code => "JPN";
//}

View File

@@ -2,8 +2,8 @@
namespace JSMR.Infrastructure.Common.SupportedLanguages;
public class KoreanLanguage : ISupportedLanguage
{
public Language Language => Language.Korean;
public string Code => "KO_KR";
}
//public class KoreanLanguage : ISupportedLanguage
//{
// public Language Language => Language.Korean;
// public string Code => "KO_KR";
//}

View File

@@ -2,8 +2,8 @@
namespace JSMR.Infrastructure.Common.SupportedLanguages;
public class SimplifiedChineseLanguage : ISupportedLanguage
{
public Language Language => Language.ChineseSimplified;
public string Code => "CHI_HANS";
}
//public class SimplifiedChineseLanguage : ISupportedLanguage
//{
// public Language Language => Language.ChineseSimplified;
// public string Code => "CHI_HANS";
//}

View File

@@ -2,8 +2,8 @@
namespace JSMR.Infrastructure.Common.SupportedLanguages;
public class TraditionalChineseLanguage : ISupportedLanguage
{
public Language Language => Language.ChineseTraditional;
public string Code => "CHI_HANT";
}
//public class TraditionalChineseLanguage : ISupportedLanguage
//{
// public Language Language => Language.ChineseTraditional;
// public string Code => "CHI_HANT";
//}

View File

@@ -1,10 +1,10 @@
using JSMR.Application.Circles.Queries.GetCreators;
using JSMR.Application.Circles.Queries.GetTags;
using JSMR.Application.Circles.Queries.Search;
using JSMR.Application.Common;
using JSMR.Application.Common.Caching;
using JSMR.Application.Creators.Ports;
using JSMR.Application.Creators.Queries.Search.Ports;
using JSMR.Application.Enums;
using JSMR.Application.Scanning.Ports;
using JSMR.Application.Tags.Ports;
using JSMR.Application.Tags.Queries.Search.Ports;
@@ -44,11 +44,11 @@ public static class InfrastructureServiceCollectionExtensions
services.AddKeyedScoped<IVoiceWorkUpdater, VoiceWorkUpdater>(Locale.Japanese);
services.AddKeyedScoped<IVoiceWorkUpdater, EnglishVoiceWorkUpdater>(Locale.English);
services.AddKeyedScoped<ISupportedLanguage, JapaneseLanguage>(Locale.Japanese);
services.AddKeyedScoped<ISupportedLanguage, EnglishLanguage>(Locale.English);
services.AddKeyedScoped<ISupportedLanguage, SimplifiedChineseLanguage>(Locale.ChineseSimplified);
services.AddKeyedScoped<ISupportedLanguage, TraditionalChineseLanguage>(Locale.ChineseTraditional);
services.AddKeyedScoped<ISupportedLanguage, KoreanLanguage>(Locale.Korean);
//services.AddKeyedScoped<ISupportedLanguage, JapaneseLanguage>(Locale.Japanese);
//services.AddKeyedScoped<ISupportedLanguage, EnglishLanguage>(Locale.English);
//services.AddKeyedScoped<ISupportedLanguage, SimplifiedChineseLanguage>(Locale.ChineseSimplified);
//services.AddKeyedScoped<ISupportedLanguage, TraditionalChineseLanguage>(Locale.ChineseTraditional);
//services.AddKeyedScoped<ISupportedLanguage, KoreanLanguage>(Locale.Korean);
services.AddScoped<ITagSearchProvider, TagSearchProvider>();
services.AddScoped<ITagWriter, TagWriter>();

View File

@@ -1,7 +1,7 @@
using JSMR.Application.Common;
using JSMR.Application.Common.Search;
using JSMR.Application.Common.Search;
using JSMR.Application.VoiceWorks.Queries.Search;
using JSMR.Domain.Entities;
using JSMR.Domain.Enums;
using JSMR.Infrastructure.Common.Queries;
using Microsoft.EntityFrameworkCore;
using System.Linq.Expressions;

View File

@@ -1,7 +1,7 @@
using JSMR.Application.Common;
using JSMR.Application.Scanning.Contracts;
using JSMR.Application.Scanning.Contracts;
using JSMR.Application.Scanning.Ports;
using JSMR.Domain.Entities;
using JSMR.Domain.Enums;
using JSMR.Infrastructure.Common.Languages;
using JSMR.Infrastructure.Data;
using Microsoft.EntityFrameworkCore;

View File

@@ -1,7 +1,8 @@
using JSMR.Application.Common;
using JSMR.Application.Scanning.Contracts;
using JSMR.Application.Scanning.Contracts;
using JSMR.Application.Scanning.Ports;
using JSMR.Domain.Entities;
using JSMR.Domain.Enums;
using JSMR.Domain.ValueObjects;
using JSMR.Infrastructure.Common.Time;
using JSMR.Infrastructure.Data;
using Microsoft.EntityFrameworkCore;
@@ -40,6 +41,7 @@ public class VoiceWorkUpdater(AppDbContext dbContext, ITimeProvider timeProvider
string[] productIds = [.. ingests.Select(i => i.ProductId).Distinct()];
string[] tagNames = [.. ingests.SelectMany(i => i.Tags).Distinct()];
string[] creatorNames = [.. ingests.SelectMany(i => i.Creators).Distinct()];
string[] seriesIdentifiers = [.. ingests.Where(i => i.Series is not null).Select(i => i.Series!.Identifier).Distinct()];
DateTimeOffset currentScanAnchor = GetCurrentScanAnchor();
DateTimeOffset previousScanAnchor = PreviousScanAnchor(currentScanAnchor);
@@ -63,6 +65,9 @@ public class VoiceWorkUpdater(AppDbContext dbContext, ITimeProvider timeProvider
Creators: await dbContext.Creators
.Where(cr => creatorNames.Contains(cr.Name))
.ToDictionaryAsync(cr => cr.Name, cancellationToken),
Series: await dbContext.Series
.Where(s => seriesIdentifiers.Contains(s.Identifier))
.ToDictionaryAsync(s => s.Identifier, cancellationToken),
Results: productIds.ToDictionary(
productId => productId,
productId => new VoiceWorkUpsertResult()
@@ -135,6 +140,7 @@ public class VoiceWorkUpdater(AppDbContext dbContext, ITimeProvider timeProvider
UpsertCreators(ingest, upsertContext);
UpsertVoiceWorkCreators(ingest, upsertContext);
UpsertVoiceWorkSupportedLanguages(ingest, upsertContext);
UpsertSeries(ingest, upsertContext);
return dbContext.Entry(voiceWork).State switch
{
@@ -183,6 +189,8 @@ public class VoiceWorkUpdater(AppDbContext dbContext, ITimeProvider timeProvider
voiceWork.HasChobit = ingest.HasDLPlay;
voiceWork.StarRating = ingest.StarRating;
voiceWork.Votes = ingest.Votes;
voiceWork.OriginalProductId = ingest.Translation?.OriginalProductId;
voiceWork.AIGeneration = (byte)ingest.AI;
voiceWork.IsValid = true;
voiceWork.LastScannedDate = ComputeLastScannedDate(voiceWork.LastScannedDate, state, upsertContext);
@@ -365,7 +373,7 @@ public class VoiceWorkUpdater(AppDbContext dbContext, ITimeProvider timeProvider
VoiceWork voiceWork = upsertContext.VoiceWorks[ingest.ProductId];
Dictionary<string, VoiceWorkSupportedLanguage> existingLanguageLinks = voiceWork.SupportedLanguages.ToDictionary(x => x.Language);
foreach (ISupportedLanguage supportedLanguage in ingest.SupportedLanguages)
foreach (SupportedLanguage supportedLanguage in ingest.SupportedLanguages)
{
if (!existingLanguageLinks.TryGetValue(supportedLanguage.Code, out VoiceWorkSupportedLanguage? voiceWorkSupportedLanguage))
{
@@ -379,4 +387,39 @@ public class VoiceWorkUpdater(AppDbContext dbContext, ITimeProvider timeProvider
}
}
}
private void UpsertSeries(VoiceWorkIngest ingest, VoiceWorkUpsertContext upsertContext)
{
Series? series = TryGetOrAddSeries(ingest, upsertContext);
VoiceWork voiceWork = upsertContext.VoiceWorks[ingest.ProductId];
voiceWork.Series = series;
}
private Series? TryGetOrAddSeries(VoiceWorkIngest ingest, VoiceWorkUpsertContext upsertContext)
{
if (ingest.Series is null)
return null;
Circle circle = upsertContext.Circles[ingest.MakerId];
if (!upsertContext.Series.TryGetValue(ingest.Series.Identifier, out Series? series))
{
series = new Series
{
Name = ingest.Series.Name,
Identifier = ingest.Series.Identifier,
Circle = circle
};
dbContext.Series.Add(series);
upsertContext.Series[ingest.Series.Identifier] = series;
}
else
{
series.Identifier = ingest.Series.Identifier;
}
return series;
}
}

View File

@@ -10,6 +10,7 @@ public record VoiceWorkUpsertContext(
Dictionary<string, VoiceWork> VoiceWorks,
Dictionary<string, Tag> Tags,
Dictionary<string, Creator> Creators,
Dictionary<string, Series> Series,
Dictionary<string, VoiceWorkUpsertResult> Results
);

View File

@@ -1,6 +1,6 @@
using JSMR.Application.Common;
using JSMR.Application.Integrations.DLSite.Models;
using JSMR.Infrastructure.Common.SupportedLanguages;
using JSMR.Application.Integrations.DLSite.Models;
using JSMR.Domain.Enums;
using JSMR.Domain.ValueObjects;
using JSMR.Infrastructure.Integrations.DLSite.Models;
namespace JSMR.Infrastructure.Integrations.DLSite.Mapping;
@@ -11,26 +11,25 @@ public static class DLSiteToDomainMapper
private const string OptDLPlay = "DLP";
private const string OptReviews = "REV";
private const string OptOfficialTranslation = "DOT";
private const string OptRecommendedTranslation = "VET";
private const string OptAIFull = "AIG";
private const string OptAIPartial = "AIP";
private static readonly (string Code, Language Lang)[] SupportedLanguageFlags =
[
("JPN", Language.Japanese),
("ENG", Language.English),
("CHI", Language.ChineseTraditional),
("CHI_HANT", Language.ChineseTraditional),
("CHI_HANS", Language.ChineseSimplified)
(SupportedLanguage.Japanese.Code, Language.Japanese),
(SupportedLanguage.English.Code, Language.English),
(SupportedLanguage.ChineseTraditional.Code, Language.ChineseTraditional),
(SupportedLanguage.ChineseSimplified.Code, Language.ChineseSimplified)
];
private static readonly (string Code, ISupportedLanguage Lang)[] SupportedLanguageFlags2 =
private static readonly (string Code, SupportedLanguage Lang)[] SupportedLanguageFlags2 =
[
("JPN", new JapaneseLanguage()),
("ENG", new EnglishLanguage()),
("CHI", new ChineseLanguage()),
("CHI_HANT", new TraditionalChineseLanguage()),
("CHI_HANS", new SimplifiedChineseLanguage())
(SupportedLanguage.Japanese.Code, SupportedLanguage.Japanese),
(SupportedLanguage.English.Code, SupportedLanguage.English),
(SupportedLanguage.ChineseTraditional.Code, SupportedLanguage.ChineseTraditional),
(SupportedLanguage.ChineseSimplified.Code, SupportedLanguage.ChineseSimplified)
];
private static readonly Dictionary<string, Language> TranslationLanguageMap =
@@ -114,18 +113,20 @@ public static class DLSiteToDomainMapper
string originalId = translationInfo.OriginalWorkNumber;
bool isOfficial = options.Contains(OptOfficialTranslation);
bool isRecommended = options.Contains(OptRecommendedTranslation);
return new VoiceWorkTranslation
{
OriginalProductId = originalId,
Language = language,
IsOfficialTranslation = isOfficial
IsOfficialTranslation = isOfficial,
IsRecommendedTranslation = isRecommended
};
}
private static ISupportedLanguage[] MapSupportedLanguages(HashSet<string> options)
private static SupportedLanguage[] MapSupportedLanguages(HashSet<string> options)
{
List<ISupportedLanguage> languages = [];
List<SupportedLanguage> languages = [];
foreach (var (code, language) in SupportedLanguageFlags2)
{

View File

@@ -1,6 +1,5 @@
using JSMR.Application.Common;
using JSMR.Domain.ValueObjects;
using JSMR.Infrastructure.Common.Locales;
using JSMR.Infrastructure.Common.SupportedLanguages;
namespace JSMR.Infrastructure.Scanning;
@@ -35,9 +34,9 @@ public class DLSiteSearchFilterBuilder
return this;
}
public DLSiteSearchFilterBuilder IncludeSupportedLanguages(ISupportedLanguage[] languages)
public DLSiteSearchFilterBuilder IncludeSupportedLanguages(SupportedLanguage[] languages)
{
foreach (ISupportedLanguage language in languages)
foreach (SupportedLanguage language in languages)
{
IncludeSupportedLanguage(language);
}
@@ -45,7 +44,7 @@ public class DLSiteSearchFilterBuilder
return this;
}
public DLSiteSearchFilterBuilder IncludeSupportedLanguage(ISupportedLanguage language)
public DLSiteSearchFilterBuilder IncludeSupportedLanguage(SupportedLanguage language)
{
AddToOptionsAnd(language.Code);

View File

@@ -1,4 +1,5 @@
using JSMR.Infrastructure.Common.Locales;
using JSMR.Domain.ValueObjects;
using JSMR.Infrastructure.Common.Locales;
using JSMR.Infrastructure.Common.SupportedLanguages;
namespace JSMR.Infrastructure.Scanning;
@@ -17,36 +18,31 @@ public static class DLSiteSearchFilterBuilderExtensions
public static DLSiteSearchFilterBuilder IncludeJapaneseSupportedLanguage(this DLSiteSearchFilterBuilder searchFilterBuilder)
{
return searchFilterBuilder.IncludeSupportedLanguage(new JapaneseLanguage());
return searchFilterBuilder.IncludeSupportedLanguage(SupportedLanguage.Japanese);
}
public static DLSiteSearchFilterBuilder IncludeEnglishSupportedLanguage(this DLSiteSearchFilterBuilder searchFilterBuilder)
{
return searchFilterBuilder.IncludeSupportedLanguage(new EnglishLanguage());
}
public static DLSiteSearchFilterBuilder IncludeChineseSupportedLanguage(this DLSiteSearchFilterBuilder searchFilterBuilder)
{
return searchFilterBuilder.IncludeSupportedLanguage(new ChineseLanguage());
return searchFilterBuilder.IncludeSupportedLanguage(SupportedLanguage.English);
}
public static DLSiteSearchFilterBuilder IncludeSimplifiedChineseSupportedLanguage(this DLSiteSearchFilterBuilder searchFilterBuilder)
{
return searchFilterBuilder.IncludeSupportedLanguage(new SimplifiedChineseLanguage());
return searchFilterBuilder.IncludeSupportedLanguage(SupportedLanguage.ChineseSimplified);
}
public static DLSiteSearchFilterBuilder IncludeTraditionalChineseSupportedLanguage(this DLSiteSearchFilterBuilder searchFilterBuilder)
{
return searchFilterBuilder.IncludeSupportedLanguage(new TraditionalChineseLanguage());
return searchFilterBuilder.IncludeSupportedLanguage(SupportedLanguage.ChineseTraditional);
}
public static DLSiteSearchFilterBuilder IncludeKoreanSupportedLanguage(this DLSiteSearchFilterBuilder searchFilterBuilder)
{
return searchFilterBuilder.IncludeSupportedLanguage(new KoreanLanguage());
return searchFilterBuilder.IncludeSupportedLanguage(SupportedLanguage.Korean);
}
public static DLSiteSearchFilterBuilder IncludeAlingualSupportedLanguage(this DLSiteSearchFilterBuilder searchFilterBuilder)
{
return searchFilterBuilder.IncludeSupportedLanguage(new AlingualLanguage());
return searchFilterBuilder.IncludeSupportedLanguage(SupportedLanguage.Alingual);
}
}

View File

@@ -1,4 +1,5 @@
using JSMR.Application.Common;
using JSMR.Domain.ValueObjects;
using JSMR.Infrastructure.Common.Locales;
using JSMR.Infrastructure.Common.SupportedLanguages;
using JSMR.Infrastructure.Http;
@@ -17,11 +18,11 @@ public partial class EnglishVoiceWorksScanner(IHtmlLoader loader) : VoiceWorksSc
protected override ILocale Locale => new EnglishLocale();
protected override ISupportedLanguage[] SupportedLanguages =>
protected override SupportedLanguage[] SupportedLanguages =>
[
new JapaneseLanguage(),
new EnglishLanguage(),
new AlingualLanguage()
SupportedLanguage.Japanese,
SupportedLanguage.English,
SupportedLanguage.Alingual
];
protected override DateOnly? GetEstimatedReleaseDate(string expectedDate)

View File

@@ -1,4 +1,5 @@
using JSMR.Application.Common;
using JSMR.Domain.ValueObjects;
using JSMR.Infrastructure.Common.Locales;
using JSMR.Infrastructure.Common.SupportedLanguages;
using JSMR.Infrastructure.Http;
@@ -16,14 +17,14 @@ public partial class JapaneseVoiceWorksScanner(IHtmlLoader loader) : VoiceWorksS
protected override ILocale Locale => new JapaneseLocale();
protected override ISupportedLanguage[] SupportedLanguages =>
protected override SupportedLanguage[] SupportedLanguages =>
[
new JapaneseLanguage(),
new EnglishLanguage(),
new TraditionalChineseLanguage(),
new SimplifiedChineseLanguage(),
new KoreanLanguage(),
new AlingualLanguage()
SupportedLanguage.Japanese,
SupportedLanguage.English,
SupportedLanguage.ChineseTraditional,
SupportedLanguage.ChineseSimplified,
SupportedLanguage.Korean,
SupportedLanguage.Alingual
];
protected override DateOnly? GetEstimatedReleaseDate(string expectedDate)

View File

@@ -1,21 +1,20 @@
using HtmlAgilityPack;
using JSMR.Application.Common;
using JSMR.Application.Scanning.Contracts;
using JSMR.Application.Scanning.Ports;
using JSMR.Domain.Enums;
using JSMR.Domain.ValueObjects;
using JSMR.Infrastructure.Common.Locales;
using JSMR.Infrastructure.Common.SupportedLanguages;
using JSMR.Infrastructure.Http;
using JSMR.Infrastructure.Scanning.Models;
using System.Globalization;
using System.Text.RegularExpressions;
using System.Xml.Linq;
namespace JSMR.Infrastructure.Scanning;
public abstract class VoiceWorksScanner(IHtmlLoader htmlLoader) : IVoiceWorksScanner
{
protected abstract ILocale Locale { get; }
protected abstract ISupportedLanguage[] SupportedLanguages { get; }
protected abstract SupportedLanguage[] SupportedLanguages { get; }
protected abstract DateOnly? GetEstimatedReleaseDate(string expectedDate);
protected abstract DateOnly? GetSalesDate(string salesDate);

View File

@@ -1,4 +1,4 @@
using JSMR.Application.Common;
using JSMR.Domain.Enums;
using JSMR.Infrastructure.Data;
using Microsoft.EntityFrameworkCore;

View File

@@ -1,8 +1,8 @@
using JSMR.Application.Common;
using JSMR.Application.Scanning.Contracts;
using JSMR.Application.Scanning.Contracts;
using JSMR.Application.Scanning.Ports;
using JSMR.Domain.Entities;
using JSMR.Infrastructure.Common.SupportedLanguages;
using JSMR.Domain.Enums;
using JSMR.Domain.ValueObjects;
using JSMR.Infrastructure.Data;
using JSMR.Tests.Fixtures;
using Microsoft.EntityFrameworkCore;
@@ -32,7 +32,7 @@ public class Fail_Attempted_Insert_With_Spam_Circle_Tests(MariaDbContainerFixtur
HasDLPlay = false,
AgeRating = AgeRating.R18,
HasImage = false,
SupportedLanguages = [new JapaneseLanguage()],
SupportedLanguages = [SupportedLanguage.Japanese],
SalesDate = null,
ExpectedDate = new DateOnly(2025, 2, 1)
};

View File

@@ -1,8 +1,8 @@
using JSMR.Application.Common;
using JSMR.Application.Scanning.Contracts;
using JSMR.Application.Scanning.Contracts;
using JSMR.Application.Scanning.Ports;
using JSMR.Domain.Entities;
using JSMR.Infrastructure.Common.SupportedLanguages;
using JSMR.Domain.Enums;
using JSMR.Domain.ValueObjects;
using JSMR.Infrastructure.Data;
using JSMR.Tests.Fixtures;
using Microsoft.EntityFrameworkCore;
@@ -34,7 +34,7 @@ public class Fail_Attempted_Update_With_Decreased_Downloads_Tests(MariaDbContain
Votes = null,
AgeRating = AgeRating.AllAges,
HasImage = true,
SupportedLanguages = [new JapaneseLanguage()],
SupportedLanguages = [SupportedLanguage.Japanese],
SalesDate = new DateOnly(2025, 1, 15),
ExpectedDate = null
};

View File

@@ -1,8 +1,8 @@
using JSMR.Application.Common;
using JSMR.Application.Scanning.Contracts;
using JSMR.Application.Scanning.Contracts;
using JSMR.Application.Scanning.Ports;
using JSMR.Domain.Entities;
using JSMR.Infrastructure.Common.SupportedLanguages;
using JSMR.Domain.Enums;
using JSMR.Domain.ValueObjects;
using JSMR.Infrastructure.Data;
using JSMR.Tests.Fixtures;
using Microsoft.EntityFrameworkCore;
@@ -34,7 +34,7 @@ public class Fail_Attempted_Update_With_Sales_Date_Reversal_Tests(MariaDbContain
Votes = null,
AgeRating = AgeRating.AllAges,
HasImage = true,
SupportedLanguages = [new JapaneseLanguage()],
SupportedLanguages = [SupportedLanguage.Japanese],
SalesDate = new DateOnly(2025, 1, 15),
ExpectedDate = null
};

View File

@@ -1,7 +1,7 @@
using JSMR.Application.Common;
using JSMR.Application.Scanning.Contracts;
using JSMR.Application.Scanning.Contracts;
using JSMR.Domain.Entities;
using JSMR.Infrastructure.Common.SupportedLanguages;
using JSMR.Domain.Enums;
using JSMR.Domain.ValueObjects;
using JSMR.Infrastructure.Data;
using JSMR.Tests.Fixtures;
using Microsoft.EntityFrameworkCore;
@@ -33,7 +33,7 @@ public class Insert_New_Release_And_Scan_Again_Later_Tests(MariaDbContainerFixtu
Votes = null,
AgeRating = AgeRating.AllAges,
HasImage = true,
SupportedLanguages = [new JapaneseLanguage()],
SupportedLanguages = [SupportedLanguage.Japanese],
SalesDate = new DateOnly(2025, 1, 15),
ExpectedDate = null
};

View File

@@ -1,8 +1,8 @@
using JSMR.Application.Common;
using JSMR.Application.Scanning.Contracts;
using JSMR.Application.Scanning.Contracts;
using JSMR.Application.Scanning.Ports;
using JSMR.Domain.Entities;
using JSMR.Infrastructure.Common.SupportedLanguages;
using JSMR.Domain.Enums;
using JSMR.Domain.ValueObjects;
using JSMR.Infrastructure.Data;
using JSMR.Tests.Fixtures;
using Microsoft.EntityFrameworkCore;
@@ -34,7 +34,7 @@ public class Insert_New_Release_With_New_Tags_And_Creators_Tests(MariaDbContaine
Votes = null,
AgeRating = AgeRating.AllAges,
HasImage = true,
SupportedLanguages = [new JapaneseLanguage()],
SupportedLanguages = [SupportedLanguage.Japanese],
SalesDate = new DateOnly(2025, 1, 15),
ExpectedDate = null
};

View File

@@ -1,7 +1,7 @@
using JSMR.Application.Common;
using JSMR.Application.Scanning.Contracts;
using JSMR.Application.Scanning.Contracts;
using JSMR.Domain.Entities;
using JSMR.Infrastructure.Common.SupportedLanguages;
using JSMR.Domain.Enums;
using JSMR.Domain.ValueObjects;
using JSMR.Infrastructure.Data;
using JSMR.Tests.Fixtures;
using Microsoft.EntityFrameworkCore;
@@ -31,7 +31,7 @@ public class Insert_New_Upcoming_And_Scan_Again_Later_Tests(MariaDbContainerFixt
HasDLPlay = false,
AgeRating = AgeRating.AllAges,
HasImage = false,
SupportedLanguages = [new JapaneseLanguage()],
SupportedLanguages = [SupportedLanguage.Japanese],
SalesDate = null,
ExpectedDate = new DateOnly(2025, 2, 1)
};

View File

@@ -1,7 +1,7 @@
using JSMR.Application.Common;
using JSMR.Application.Scanning.Contracts;
using JSMR.Application.Scanning.Contracts;
using JSMR.Domain.Entities;
using JSMR.Infrastructure.Common.SupportedLanguages;
using JSMR.Domain.Enums;
using JSMR.Domain.ValueObjects;
using JSMR.Infrastructure.Data;
using JSMR.Tests.Fixtures;
using Microsoft.EntityFrameworkCore;
@@ -31,7 +31,7 @@ public class Insert_New_Upcoming_Release_Same_Day_Tests(MariaDbContainerFixture
HasDLPlay = false,
AgeRating = AgeRating.AllAges,
HasImage = false,
SupportedLanguages = [new JapaneseLanguage()],
SupportedLanguages = [SupportedLanguage.Japanese],
SalesDate = null,
ExpectedDate = new DateOnly(2025, 2, 1)
};

View File

@@ -1,8 +1,8 @@
using JSMR.Application.Common;
using JSMR.Application.Scanning.Contracts;
using JSMR.Application.Scanning.Contracts;
using JSMR.Application.Scanning.Ports;
using JSMR.Domain.Entities;
using JSMR.Infrastructure.Common.SupportedLanguages;
using JSMR.Domain.Enums;
using JSMR.Domain.ValueObjects;
using JSMR.Infrastructure.Data;
using JSMR.Tests.Fixtures;
using Microsoft.EntityFrameworkCore;
@@ -34,7 +34,7 @@ public class Insert_New_Upcoming_With_Existing_Tags_And_Creators_Tests(MariaDbCo
Votes = null,
AgeRating = AgeRating.R15,
HasImage = true,
SupportedLanguages = [new JapaneseLanguage()],
SupportedLanguages = [SupportedLanguage.Japanese],
SalesDate = null,
ExpectedDate = new DateOnly(2025, 1, 20),
RegistrationDate = null

View File

@@ -2,7 +2,6 @@
using JSMR.Application.Scanning.Contracts;
using JSMR.Application.Scanning.Ports;
using JSMR.Domain.Entities;
using JSMR.Infrastructure.Common.SupportedLanguages;
using JSMR.Infrastructure.Common.Time;
using JSMR.Infrastructure.Data;
using JSMR.Infrastructure.Ingestion;

View File

@@ -1,4 +1,4 @@
using JSMR.Application.Common;
using JSMR.Domain.Enums;
using JSMR.Infrastructure.Data;
using Microsoft.EntityFrameworkCore;

View File

@@ -1,5 +1,5 @@
using JSMR.Application.Common;
using JSMR.Application.Integrations.DLSite.Models;
using JSMR.Application.Integrations.DLSite.Models;
using JSMR.Domain.Enums;
using JSMR.Infrastructure.Http;
using JSMR.Infrastructure.Integrations.DLSite;
using JSMR.Infrastructure.Integrations.DLSite.Mapping;