MediatR Commands (CQRS Pattern): - CreateEmailProfileCommand + Handler - UpdateEmailProfileCommand + Handler - DeleteEmailProfileCommand + Handler - CreateEmailAccountCommand + Handler - ProcessEmailCommand + Handler (core email processing logic) Command Handlers: - Create/Update/Delete operations for EmailProfile - Create operation for EmailAccount - ProcessEmail: Complete email processing workflow including: * Duplicate detection using MessageId hash * Email history creation * PDF attachment validation * windream DMS archiving support (placeholder) * Domain event publishing (EmailProcessedEvent) * Error handling and status tracking Exception Improvements: - Added ErrorCode property to DomainException - Added ErrorCode overload to ValidationException - Simplified AttachmentProcessingException to use base ErrorCode Field Mappings Fixed: - EmailProfile: ProcessId (not EmailProcessId), ValidationSql (not SenderFilter/SubjectFilter) - EmailAccount: Username, EncryptedPassword, UseOAuth2, EncryptedClientSecret - EmailHistory: SenderAddress, EmailDate, OriginalMessageId, EmailBodyText/Html - EmailAttachment: OriginalFileName, SavedFileName, FilePath, FileSize - Audit fields: AddedWhen/AddedWho, ChangedWhen/ChangedWho (not CreatedDate/By, ModifiedDate/By) All commands follow Clean Architecture and use UnitOfWork pattern. Build successful with 1 minor warning (dmsService marked for future implementation).
17 lines
529 B
C#
17 lines
529 B
C#
using MediatR;
|
|
|
|
namespace DigitalData.EmailProfiler.Application.Features.EmailProfiles.Commands;
|
|
|
|
/// <summary>
|
|
/// Command to create a new email profile.
|
|
/// </summary>
|
|
public record CreateEmailProfileCommand : IRequest<int>
|
|
{
|
|
public string ProfileName { get; init; } = string.Empty;
|
|
public int EmailAccountId { get; init; }
|
|
public int? ProcessId { get; init; }
|
|
public string? ValidationSql { get; init; }
|
|
public int PollIntervalMinutes { get; init; } = 15;
|
|
public bool IsActive { get; init; } = true;
|
|
}
|