feat(application): add ToSender helper for email accounts

Adds GetEmailAccountQueryExtensions.ToSender to build a sender query from an email address, and documents its use on PublishEmailViaSmtpCommand.Sender.
This commit is contained in:
2026-11-05 09:44:59 +01:00
parent f799cdf2c4
commit 4a39e3f92b
2 changed files with 20 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
#if NET
using DigitalData.MessagingService.Application.EmailAccounts.Queries;
namespace DigitalData.MessagingService.Application.EmailSending.Commands;
public static class GetEmailAccountQueryExtensions
{
public static GetEmailAccountQuery ToSender(string emailAddress)
{
return new GetEmailAccountQuery
{
Username = emailAddress
};
}
}
#endif

View File

@@ -17,6 +17,10 @@ namespace DigitalData.MessagingService.Application.EmailSending.Commands;
/// </summary>
public record PublishEmailViaSmtpCommand : IRequest<Guid>
{
/// <summary>
/// Specifies the sender's email account to resolve, identified by either its Id or Username.
/// Use <see cref="GetEmailAccountQueryExtensions.ToSender(string)"/> to create a query from an email address.
/// </summary>
public required GetEmailAccountQuery Sender { get; init; }
/// <summary>