6dcc911fc2
- 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>
40 lines
1.5 KiB
C#
40 lines
1.5 KiB
C#
using HrynCo.NotificationService.DAL.EF.Entities;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
|
|
namespace HrynCo.NotificationService.DAL.EF.Configurations;
|
|
|
|
internal class EmailChannelEntityConfiguration : IEntityTypeConfiguration<EmailChannelEntity>
|
|
{
|
|
public void Configure(EntityTypeBuilder<EmailChannelEntity> builder)
|
|
{
|
|
builder.ToTable("providers");
|
|
|
|
builder.HasKey(x => x.Id);
|
|
builder.Property(x => x.Id).HasColumnName("id");
|
|
|
|
builder.Property(x => x.ServiceName)
|
|
.HasColumnName("service_name")
|
|
.IsRequired()
|
|
.HasMaxLength(100);
|
|
|
|
builder.HasIndex(x => new { x.ServiceName, x.Priority });
|
|
|
|
builder.Property(x => x.Priority).HasColumnName("priority");
|
|
|
|
builder.Property(x => x.EmailChannelType).HasColumnName("provider_type");
|
|
|
|
builder.Property(x => x.SettingsJson)
|
|
.HasColumnName("settings")
|
|
.HasColumnType("jsonb")
|
|
.IsRequired();
|
|
|
|
builder.Property(x => x.DailyLimit).HasColumnName("daily_limit");
|
|
builder.Property(x => x.MonthlyLimit).HasColumnName("monthly_limit");
|
|
builder.Property(x => x.WarnThresholdPercent).HasColumnName("warn_threshold_percent");
|
|
builder.Property(x => x.IsActive).HasColumnName("is_active");
|
|
builder.Property(x => x.Created).HasColumnName("created");
|
|
builder.Property(x => x.Updated).HasColumnName("updated");
|
|
}
|
|
}
|