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,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)
{