From 4e107d928ed0743264d59775a788a690ba48fe83 Mon Sep 17 00:00:00 2001 From: TekH Date: Wed, 3 Dec 2025 13:08:00 +0100 Subject: [PATCH] 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. --- src/ReC.Application/RecActions/MappingProfile.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ReC.Application/RecActions/MappingProfile.cs b/src/ReC.Application/RecActions/MappingProfile.cs index 7955c35..13f659b 100644 --- a/src/ReC.Application/RecActions/MappingProfile.cs +++ b/src/ReC.Application/RecActions/MappingProfile.cs @@ -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(); + CreateMap() + .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")); } } \ No newline at end of file