Refactor: Rename OutgoingEmail to SendingEmail

This commit renames and refactors all instances of `OutgoingEmail` to `SendingEmail` across the codebase to improve terminology consistency and align with domain language.

- Renamed classes, interfaces, and records (e.g., `OutgoingEmailPublisher` → `SendingEmailPublisher`, `OutgoingEmailEvent` → `SendingEmailEvent`).
- Updated method signatures, parameters, and return types to use `SendingEmail`.
- Adjusted dependency injection registrations to reflect the new naming.
- Updated mappings in `EmailMappingProfile` to map `SendEmailCommand` to `SendingEmailEvent`.
- Refactored `SendEmailCommand` and its handler to work with `SendingEmailEvent`.
- Updated `EmailsController` to use `SendingEmailEvent` in the `SendEmail` action.
- Refactored integration tests to test `SendingEmailPublisher` and updated test data accordingly.
- Updated log messages, error handling, and comments to reflect the new terminology.
- Revised documentation and utility methods to use `SendingEmailEvent`.

This refactor ensures consistency, improves readability, and reduces ambiguity in the codebase.
This commit is contained in:
2026-08-05 13:26:21 +02:00
parent e550db8789
commit 58ad50b96b
15 changed files with 55 additions and 55 deletions

View File

@@ -23,11 +23,11 @@ public class EmailsController(IMediator mediator) : ControllerBase
[ProducesResponseType(StatusCodes.Status400BadRequest)]
public async Task<IActionResult> SendEmail([FromBody] SendEmailCommand command, CancellationToken cancellationToken)
{
var outgoingEmailEvent = await mediator.Send(command, cancellationToken);
var sendingEmailEvent = await mediator.Send(command, cancellationToken);
return Accepted(new
{
outgoingEmailEvent.Id,
sendingEmailEvent.Id,
});
}
}

View File

@@ -28,12 +28,12 @@ public record Email
public bool IsHtml { get; set; } = true;
/// <summary>
/// Converts this <see cref="Email"/> instance to an <see cref="OutgoingEmailEvent"/>.
/// Converts this <see cref="Email"/> instance to an <see cref="SendingEmailEvent"/>.
/// </summary>
/// <returns>A new <see cref="OutgoingEmailEvent"/> representing this email.</returns>
internal OutgoingEmailEvent ToEvent()
/// <returns>A new <see cref="SendingEmailEvent"/> representing this email.</returns>
internal SendingEmailEvent ToEvent()
{
return new OutgoingEmailEvent
return new SendingEmailEvent
{
Id = Guid.NewGuid(),
Recipients = Recipients,

View File

@@ -113,8 +113,8 @@ public static class EmailSender
/// Thrown when <see cref="ConnectRabbitMq(Action{RabbitMqConfiguration}, OnReconnect)"/> has not been called prior to sending.
/// </exception>
/// <remarks>
/// This method maps <see cref="Email"/> to <see cref="OutgoingEmailEvent"/>,
/// then resolves <see cref="IOutgoingEmailPublisher"/> from the internal
/// This method maps <see cref="Email"/> to <see cref="SendingEmailEvent"/>,
/// then resolves <see cref="ISendingEmailPublisher"/> from the internal
/// service provider and calls <c>EnqueueAsync</c> in a fire-and-forget manner.
/// Ensure that any unhandled exceptions from the async operation are handled
/// at the publisher level.
@@ -124,7 +124,7 @@ public static class EmailSender
if(!IsConnected)
throw new InvalidOperationException("Messaging service is not connected. Call ConnectRabbitMq first.");
var publisher = LazyProvider.Value.GetRequiredService<IOutgoingEmailPublisher>();
var publisher = LazyProvider.Value.GetRequiredService<ISendingEmailPublisher>();
publisher.EnqueueAsync(email.ToEvent());
}
}