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:
parent
3e6c2ea12b
commit
4e107d928e
@ -3,10 +3,14 @@ using ReC.Domain.Entities;
|
|||||||
|
|
||||||
namespace ReC.Application.RecActions;
|
namespace ReC.Application.RecActions;
|
||||||
|
|
||||||
|
// TODO: update to inject AddedWho from the current host/user contex
|
||||||
public class MappingProfile : AutoMapper.Profile
|
public class MappingProfile : AutoMapper.Profile
|
||||||
{
|
{
|
||||||
public MappingProfile()
|
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"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user