Add support for email attachments in SendEmailCommand
Enhanced the email-sending workflow to support attachments: - Updated `SendEmailCommand` with an `Attachments` property. - Added `WithAttachments` method to handle attachment initialization. - Modified `EmailsController` to accept file uploads via `IFormFileCollection`. - Implemented `BuildAttachmentsAsync` to process uploaded files. - Updated `EmailMappingProfile` to map `Attachments` to `EmailContext`. - Adjusted `SendEmail` endpoint to consume `multipart/form-data`. - Enhanced `SendEmail` response to include the queued event ID. - Updated project file to include Swagger infrastructure folder. These changes enable handling of email attachments and improve API functionality.
This commit is contained in:
@@ -14,6 +14,7 @@ public class EmailMappingProfile : Profile
|
||||
// SendEmailCommand -> Email
|
||||
// Sender is resolved via MediatR in the handler and set separately after mapping.
|
||||
CreateMap<SendEmailCommand, EmailContext>()
|
||||
.ForMember(dest => dest.Sender, opt => opt.Ignore());
|
||||
.ForMember(dest => dest.Sender, opt => opt.Ignore())
|
||||
.ForMember(dest => dest.Attachments, opt => opt.MapFrom(src => src.Attachments));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user