feat(templates): add service language template management
Add normalized service and template catalogs, scoped administration, migration, validation, and regression coverage. Ref: IT-1601
This commit is contained in:
@@ -21,15 +21,21 @@ internal sealed class EmailTemplateService : IEmailTemplateService
|
||||
if (string.IsNullOrWhiteSpace(languageCode))
|
||||
throw new InvalidDataException("LanguageCode is required.");
|
||||
|
||||
string lang = languageCode.Trim().ToLowerInvariant();
|
||||
EmailTemplate? template = await _templateRepository.GetAsync(
|
||||
serviceName,
|
||||
templateKey,
|
||||
lang,
|
||||
languageCode,
|
||||
cancellationToken);
|
||||
|
||||
if (template is null)
|
||||
{
|
||||
string compatibilityCode = languageCode.Trim().ToLowerInvariant();
|
||||
if (!string.Equals(languageCode, compatibilityCode, StringComparison.Ordinal))
|
||||
template = await _templateRepository.GetAsync(serviceName, templateKey, compatibilityCode, cancellationToken);
|
||||
}
|
||||
|
||||
return template
|
||||
?? throw new InvalidOperationException(
|
||||
$"Template not found: service='{serviceName}' key='{templateKey}' language='{lang}'.");
|
||||
$"Template not found: service='{serviceName}' key='{templateKey}' language='{languageCode}'.");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user