refactor: rename domain types and introduce TransactionBehavior pattern
- Rename Template -> EmailTemplate, Provider -> EmailChannel, ProviderSettings -> EmailChannelSettings, ProviderType -> EmailChannelType, ProviderUsage -> EmailChannelUsage throughout all layers - Add Undefined = 0 to EmailChannelType enum for safe default handling - Remove SaveChangesAsync from EfRepository methods — repositories now only stage changes - Add SaveChangesAsync to IUnitOfWork and EfUnitOfWork - Add TransactionBehavior MediatR pipeline: wraps every handler in a transaction, saves and commits on success, rolls back on exception - Add MediatR package reference to Services project Ref: IT-628 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
+4
-4
@@ -3,15 +3,15 @@ using HrynCo.NotificationService.DAL.Abstract.Providers;
|
||||
|
||||
namespace HrynCo.NotificationService.DAL.EF.Entities;
|
||||
|
||||
internal class ProviderEntity : Entity
|
||||
internal class EmailChannelEntity : Entity
|
||||
{
|
||||
public required string ServiceName { get; set; }
|
||||
public int Priority { get; set; }
|
||||
public ProviderType ProviderType { get; set; }
|
||||
public EmailChannelType EmailChannelType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Provider-specific credentials and settings stored as JSONB.
|
||||
/// Deserialized based on <see cref="ProviderType"/> in the repository.
|
||||
/// EmailChannel-specific credentials and settings stored as JSONB.
|
||||
/// Deserialized based on <see cref="EmailChannelType"/> in the repository.
|
||||
/// </summary>
|
||||
public required string SettingsJson { get; set; }
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ using HrynCo.NotificationService.DAL.Abstract.Entities;
|
||||
|
||||
namespace HrynCo.NotificationService.DAL.EF.Entities;
|
||||
|
||||
internal class ProviderUsageEntity : Entity
|
||||
internal class EmailChannelUsageEntity : Entity
|
||||
{
|
||||
public Guid ProviderId { get; set; }
|
||||
public DateOnly Date { get; set; }
|
||||
+3
-3
@@ -2,7 +2,7 @@ using HrynCo.NotificationService.DAL.Abstract.Entities;
|
||||
|
||||
namespace HrynCo.NotificationService.DAL.EF.Entities;
|
||||
|
||||
internal class TemplateEntity : Entity
|
||||
internal class EmailTemplateEntity : Entity
|
||||
{
|
||||
public required string ServiceName { get; set; }
|
||||
public required string Key { get; set; }
|
||||
@@ -10,10 +10,10 @@ internal class TemplateEntity : Entity
|
||||
public required string Subject { get; set; }
|
||||
public required string HtmlBody { get; set; }
|
||||
public required string TextBody { get; set; }
|
||||
public List<TemplateVariableData> Variables { get; set; } = [];
|
||||
public List<EmailTemplateVariableData> Variables { get; set; } = [];
|
||||
}
|
||||
|
||||
internal class TemplateVariableData
|
||||
internal class EmailTemplateVariableData
|
||||
{
|
||||
public required string Name { get; set; }
|
||||
public bool Required { get; set; }
|
||||
Reference in New Issue
Block a user