Repository Interfaces (Clean Architecture - Application Layer): - IRepository<T>: Base repository interface with common CRUD operations - IEmailAccountRepository: Email account operations (GetActive, GetByName, GetWithProfiles) - IEmailProfileRepository: Profile operations (GetActive, GetDueForPolling, GetWithRelated) - IEmailProcessRepository: Process operations (GetWithSteps, GetByType) - IEmailHistoryRepository: History operations (pagination, duplicate detection, date range queries) - IEmailOutboxRepository: Outbox operations (GetPending, GetForRetry, MarkAsSent/Failed) - IUnitOfWork: Transaction management and repository aggregation Service Interfaces (Abstraction for Infrastructure): - IEmailService: IMAP/SMTP operations with OAuth2 support (MailKit wrapper) - IPdfProcessingService: PDF validation, embedded file extraction, ZUGFeRD support - IDmsService: windream DMS integration (archive, search, update index fields) - IEncryptionService: Data protection for passwords and OAuth tokens - IEmailQueue: Async email queue (in-memory Channel, future: RabbitMQ) Dependencies: - Added MimeKit 4.17.0 for email service interface definitions All interfaces follow Clean Architecture principles: - Interfaces in Application layer - Implementations will be in Infrastructure layer
48 lines
1.6 KiB
C#
48 lines
1.6 KiB
C#
using DigitalData.EmailProfiler.Domain.Entities;
|
|
|
|
namespace DigitalData.EmailProfiler.Application.Interfaces.Repositories;
|
|
|
|
/// <summary>
|
|
/// Repository interface for EmailHistory entity.
|
|
/// </summary>
|
|
public interface IEmailHistoryRepository : IRepository<EmailHistory>
|
|
{
|
|
/// <summary>
|
|
/// Get email history by message ID hash.
|
|
/// </summary>
|
|
Task<EmailHistory?> GetByMessageIdHashAsync(string messageIdHash, CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// Get email history with attachments.
|
|
/// </summary>
|
|
Task<EmailHistory?> GetWithAttachmentsAsync(int id, CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// Get email history by profile ID with pagination.
|
|
/// </summary>
|
|
Task<(IEnumerable<EmailHistory> Items, int TotalCount)> GetByProfileIdAsync(
|
|
int profileId,
|
|
int pageNumber = 1,
|
|
int pageSize = 50,
|
|
CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// Get failed emails that need retry.
|
|
/// </summary>
|
|
Task<IEnumerable<EmailHistory>> GetFailedEmailsAsync(int? profileId = null, CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// Get emails processed within date range.
|
|
/// </summary>
|
|
Task<IEnumerable<EmailHistory>> GetByDateRangeAsync(
|
|
DateTime startDate,
|
|
DateTime endDate,
|
|
int? profileId = null,
|
|
CancellationToken cancellationToken = default);
|
|
|
|
/// <summary>
|
|
/// Check if email with given message ID hash already exists.
|
|
/// </summary>
|
|
Task<bool> IsDuplicateAsync(string messageIdHash, CancellationToken cancellationToken = default);
|
|
}
|