feat: add base entity abstractions and domain model to DAL.Abstract

- IEntity<TId>, Entity<TId>, Entity base classes in Entities/
- Template, TemplateVariable domain models in Templates/
- Provider, ProviderSettings, SmtpProviderSettings, ProviderUsage, ProviderType in Providers/
- ITemplateRepository, IProviderRepository, IProviderUsageRepository in Repositories/
- ProviderUsage tracks daily counts; monthly derived by summing daily records
- IEntity<TId> lives in DAL.Abstract (not DAL.EF) — boundary enforced from the start

Ref: IT-628

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Anatolii Grynchuk
2026-05-01 19:28:34 +03:00
parent ed4a6578c3
commit 7cb691db14
14 changed files with 136 additions and 18 deletions
@@ -0,0 +1,15 @@
using HrynCo.NotificationService.DAL.Abstract.Entities;
namespace HrynCo.NotificationService.DAL.Abstract.Providers;
public class Provider : Entity
{
public required string ServiceName { get; set; }
public int Priority { get; set; }
public ProviderType ProviderType { get; set; }
public required ProviderSettings Settings { get; set; }
public int? DailyLimit { get; set; }
public int? MonthlyLimit { get; set; }
public int WarnThresholdPercent { get; set; } = 90;
public bool IsActive { get; set; } = true;
}
@@ -0,0 +1,21 @@
namespace HrynCo.NotificationService.DAL.Abstract.Providers;
public abstract class ProviderSettings
{
public abstract ProviderType ProviderType { get; }
}
public class SmtpProviderSettings : ProviderSettings
{
public override ProviderType ProviderType => ProviderType.Smtp;
public required string Host { get; set; }
public int Port { get; set; } = 587;
public required string Username { get; set; }
public required string Password { get; set; }
public bool UseSsl { get; set; } = true;
public required string FromEmail { get; set; }
public required string FromName { get; set; }
public required string AppDisplayName { get; set; }
public required string AppBaseUrl { get; set; }
}
@@ -0,0 +1,6 @@
namespace HrynCo.NotificationService.DAL.Abstract.Providers;
public enum ProviderType
{
Smtp = 1
}
@@ -0,0 +1,14 @@
using HrynCo.NotificationService.DAL.Abstract.Entities;
namespace HrynCo.NotificationService.DAL.Abstract.Providers;
/// <summary>
/// Tracks email send counts per provider per calendar day.
/// Monthly counts are derived by summing daily records within a month.
/// </summary>
public class ProviderUsage : Entity
{
public Guid ProviderId { get; set; }
public DateOnly Date { get; set; }
public int SentCount { get; set; }
}