From 606ff94a7784b30ede48108f5d04bb20757ce0f8 Mon Sep 17 00:00:00 2001 From: TekH Date: Thu, 13 Aug 2026 12:09:44 +0200 Subject: [PATCH] Rename FetchEmailsQuery to ReadEmailQuery Renamed `FetchEmailsQuery` to `ReadEmailQuery` across the codebase, including its handler, validator, and usages in `EmailController`. Updated method signatures, dependencies, and XML documentation to reflect the new naming convention. Adjusted `ILogger` dependency in the handler to match the renamed class. --- .../Queries/{FetchEmailsQuery.cs => ReadEmailQuery.cs} | 6 +++--- .../EmailReceiving/Validators/FetchEmailsQueryValidator.cs | 4 ++-- .../Controllers/EmailController.cs | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) rename src/core/DigitalData.MessagingService.Application/EmailReceiving/Queries/{FetchEmailsQuery.cs => ReadEmailQuery.cs} (83%) diff --git a/src/core/DigitalData.MessagingService.Application/EmailReceiving/Queries/FetchEmailsQuery.cs b/src/core/DigitalData.MessagingService.Application/EmailReceiving/Queries/ReadEmailQuery.cs similarity index 83% rename from src/core/DigitalData.MessagingService.Application/EmailReceiving/Queries/FetchEmailsQuery.cs rename to src/core/DigitalData.MessagingService.Application/EmailReceiving/Queries/ReadEmailQuery.cs index 8c69d8b..c1274e4 100644 --- a/src/core/DigitalData.MessagingService.Application/EmailReceiving/Queries/FetchEmailsQuery.cs +++ b/src/core/DigitalData.MessagingService.Application/EmailReceiving/Queries/ReadEmailQuery.cs @@ -14,7 +14,7 @@ namespace DigitalData.MessagingService.Application.EmailReceiving.Queries; /// /// Query to fetch emails from an IMAP mailbox. /// -public record FetchEmailsQuery : IRequest> +public record ReadEmailQuery : IRequest> { /// /// Identifies the email account to use. @@ -27,9 +27,9 @@ public record FetchEmailsQuery : IRequest> public MailSearchFilter Mail { get; init; } = new(); } -public class FetchEmailsQueryHandler(IImapEmailService ImapService, ILogger Logger, IRepository Repo) : IRequestHandler> +public class ReadEmailQueryHandler(IImapEmailService ImapService, ILogger Logger, IRepository Repo) : IRequestHandler> { - public async Task> Handle(FetchEmailsQuery request, CancellationToken cancellationToken) + public async Task> Handle(ReadEmailQuery request, CancellationToken cancellationToken) { var accounts = await Repo.FindAsync(request.Account.Id is int id ? x => x.Id == id : x => x.Username == request.Account.Username, cancellationToken: cancellationToken); diff --git a/src/core/DigitalData.MessagingService.Application/EmailReceiving/Validators/FetchEmailsQueryValidator.cs b/src/core/DigitalData.MessagingService.Application/EmailReceiving/Validators/FetchEmailsQueryValidator.cs index 5ce58b3..4b49283 100644 --- a/src/core/DigitalData.MessagingService.Application/EmailReceiving/Validators/FetchEmailsQueryValidator.cs +++ b/src/core/DigitalData.MessagingService.Application/EmailReceiving/Validators/FetchEmailsQueryValidator.cs @@ -5,9 +5,9 @@ using FluentValidation; namespace DigitalData.MessagingService.Application.EmailReceiving.Validators; /// -/// Validates a before it is handled by . +/// Validates a before it is handled by . /// -public class FetchEmailsQueryValidator : AbstractValidator +public class FetchEmailsQueryValidator : AbstractValidator { public FetchEmailsQueryValidator() { diff --git a/src/presentation/DigitalData.MessagingService.API/Controllers/EmailController.cs b/src/presentation/DigitalData.MessagingService.API/Controllers/EmailController.cs index f35aa42..dbd7609 100644 --- a/src/presentation/DigitalData.MessagingService.API/Controllers/EmailController.cs +++ b/src/presentation/DigitalData.MessagingService.API/Controllers/EmailController.cs @@ -92,7 +92,7 @@ public class EmailController(IMediator mediator) : ControllerBase [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status400BadRequest)] [ProducesResponseType(StatusCodes.Status404NotFound)] - public async Task FetchEmails([FromQuery] FetchEmailsQuery query, [FromQuery] OnlyFilter? only = null, CancellationToken cancellationToken = default) + public async Task FetchEmails([FromQuery] ReadEmailQuery query, [FromQuery] OnlyFilter? only = null, CancellationToken cancellationToken = default) { var emails = await mediator.Send(query, cancellationToken);