Files
hrynco-notification-service/HrynCo.NotificationService.Web/Controllers/Admin/ViewModels/EmailChannelEditViewModel.cs
T
Anatolii Grynchuk 2b272e989b refactor: channel holds delivery config only — remove AppDisplayName, AppBaseUrl
- SmtpChannelSettings: Host, Port, Username, Password, UseSsl, FromEmail, FromName only
- AppDisplayName and AppBaseUrl moved to template variables (payload responsibility)
- Updated ViewModel, controller Save/Edit mapping, and Edit view accordingly

Ref: IT-628

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-02 03:08:12 +03:00

52 lines
1.7 KiB
C#

using System.ComponentModel.DataAnnotations;
using HrynCo.NotificationService.DAL.Abstract.Providers;
namespace HrynCo.NotificationService.Web.Controllers.Admin.ViewModels;
public class EmailChannelEditViewModel
{
public Guid Id { get; set; }
// ── Channel fields ─────────────────────────────────────────────────
[Required]
public string ServiceName { get; set; } = "";
public int Priority { get; set; } = 1;
public EmailChannelType EmailChannelType { get; set; } = EmailChannelType.Smtp;
public int? DailyLimit { get; set; }
public int? MonthlyLimit { get; set; }
[Range(1, 100)]
public int WarnThresholdPercent { get; set; } = 90;
public bool IsActive { get; set; } = true;
// ── SMTP Settings ──────────────────────────────────────────────────
[Required]
public string Host { get; set; } = "";
[Range(1, 65535)]
public int Port { get; set; } = 587;
[Required]
public string Username { get; set; } = "";
[Required]
public string Password { get; set; } = "";
public bool UseSsl { get; set; } = true;
[Required, EmailAddress]
public string FromEmail { get; set; } = "";
[Required]
public string FromName { get; set; } = "";
// ── Computed ───────────────────────────────────────────────────────
public bool IsNew => Id == Guid.Empty;
public string PageTitle => IsNew ? "Create Channel" : "Edit Channel";
}