Add AutoMapper auditing extensions for timestamp fields
Introduced AutoMapperAuditingExtensions with MapAddedWhen and MapChangedWhen methods to standardize mapping of auditing timestamps. Refactored MappingProfile to use these extensions for AddedWhen and ChangedWhen fields, improving code clarity. Updated DocumentStatus to implement auditing interfaces and added necessary imports.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using AutoMapper;
|
||||
using EnvelopeGenerator.Application.Common.Extensions;
|
||||
using EnvelopeGenerator.Application.DocStatus.Commands;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
|
||||
@@ -16,10 +17,12 @@ public class MappingProfile : Profile
|
||||
{
|
||||
CreateMap<CreateDocStatusCommand, DocumentStatus>()
|
||||
.ForMember(dest => dest.Envelope, opt => opt.Ignore())
|
||||
.ForMember(dest => dest.Receiver, opt => opt.Ignore());
|
||||
.ForMember(dest => dest.Receiver, opt => opt.Ignore())
|
||||
.MapAddedWhen();
|
||||
|
||||
CreateMap<UpdateDocStatusCommand, DocumentStatus>()
|
||||
.ForMember(dest => dest.Envelope, opt => opt.Ignore())
|
||||
.ForMember(dest => dest.Receiver, opt => opt.Ignore());
|
||||
.ForMember(dest => dest.Receiver, opt => opt.Ignore())
|
||||
.MapChangedWhen();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user