Enhance mapping in MappingProfile.cs

Updated the `MappingProfile` class to include custom mappings for the `CreateRecActionCommand` to `RecAction` transformation:
- Set `Active` to `true` by default.
- Set `AddedWhen` to the current UTC time.
- Set `AddedWho` to `"ReC.API"` as a placeholder.
Added a `TODO` comment to replace the hardcoded `AddedWho` value with dynamic injection from the current host/user context.
This commit is contained in:
tekh 2025-12-03 13:08:00 +01:00
parent 3e6c2ea12b
commit 4e107d928e

View File

@ -3,10 +3,14 @@ using ReC.Domain.Entities;
namespace ReC.Application.RecActions;
// TODO: update to inject AddedWho from the current host/user contex
public class MappingProfile : AutoMapper.Profile
{
public MappingProfile()
{
CreateMap<CreateRecActionCommand, RecAction>();
CreateMap<CreateRecActionCommand, RecAction>()
.ForMember(e => e.Active, exp => exp.MapFrom(cmd => true))
.ForMember(e => e.AddedWhen, exp => exp.MapFrom(cmd => DateTime.UtcNow))
.ForMember(e => e.AddedWho, exp => exp.MapFrom(cmd => "ReC.API"));
}
}