Refactor UpdateEmailTemplateCommand and handler

- Introduce EmailTemplateUpdateDto for update payloads.
- Expose Id and Type directly on UpdateEmailTemplateCommand; remove EmailTemplateQuery property.
- Add QueryExpression for flexible template selection by Id or Type.
- Remove AutoMapper and EmailTemplateDto usage from handler; update repository call to use EmailTemplateUpdateDto.
- Update MappingProfile to map EmailTemplateUpdateDto to EmailTemplate and set ChangedWhen to DateTime.UtcNow.
- Remove obsolete code and improve documentation.
This commit is contained in:
2026-02-09 11:20:34 +01:00
parent de36e29743
commit b227eb4051
2 changed files with 44 additions and 55 deletions

View File

@@ -17,8 +17,7 @@ public class MappingProfile : Profile
{
CreateMap<EmailTemplate, EmailTemplateDto>();
CreateMap<UpdateEmailTemplateCommand, EmailTemplate>()
.ForMember(dest => dest.Id, opt => opt.Ignore())
.ForMember(dest => dest.ChangedWhen, opt => opt.MapFrom(_ => DateTime.Now));
CreateMap<EmailTemplateUpdateDto, EmailTemplate>()
.ForMember(dest => dest.ChangedWhen, opt => opt.MapFrom(_ => DateTime.UtcNow));
}
}