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:
2026-10-17 22:02:43 +03:00
parent 36810dc5f1
commit 81654c0d33
73 changed files with 4061 additions and 820 deletions
@@ -7,5 +7,6 @@ namespace HrynCo.NotificationService.Services.EmailTemplates.Delete;
public sealed record DeleteEmailTemplateCommand(
string ServiceName,
string Key,
string LanguageCode
string LanguageCode,
Guid? ExpectedVersionId = null
) : IRequest<ServiceResult<Unit>>;
@@ -1,3 +1,4 @@
using HrynCo.NotificationService.DAL.Abstract.Templates;
using HrynCo.DAL.Abstract;
using HrynCo.NotificationService.DAL.Abstract.Repositories;
using HrynCo.NotificationService.Services.Core;
@@ -27,8 +28,17 @@ internal sealed class DeleteEmailTemplateHandler
if (template is null)
return Failure<Unit>("Template not found.", ServiceErrorCode.NotFound);
if (request.ExpectedVersionId is Guid expectedId && template.Id != expectedId)
return Failure<Unit>("Template changed after you opened it. Reload before deleting.", ServiceErrorCode.Conflict);
await _templates.DeleteAsync(template, cancellationToken);
try
{
await _templates.DeleteAsync(template, cancellationToken);
}
catch (EmailTemplateWriteException error)
{
return Failure<Unit>(error.Message, error.IsConflict ? ServiceErrorCode.Conflict : ServiceErrorCode.InvalidRequest);
}
return Success(Unit.Value);
}