Add mappings for AddedWhen and AddedWho in MappingProfile

Added a TODO comment to update `AddedWho` to be injected
from the current host/user context. Configured `AddedWhen`
to use the current UTC time (`DateTime.UtcNow`) and set
`AddedWho` to the string `"ReC.API"`.
This commit is contained in:
tekh 2025-12-03 12:50:38 +01:00
parent 6e68083a8d
commit 1e21d133ae

View File

@ -3,11 +3,14 @@ using ReC.Domain.Entities;
namespace ReC.Application.Endpoints; namespace ReC.Application.Endpoints;
// 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<ObtainEndpointCommand, Endpoint>() CreateMap<ObtainEndpointCommand, Endpoint>()
.ForMember(e => e.Active, exp => exp.MapFrom(cmd => true)); .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"));
} }
} }