Set Active property to true in ObtainEndpointCommand map

Updated the `MappingProfile` class to configure the mapping
between `ObtainEndpointCommand` and `Endpoint` to explicitly
set the `Active` property of `Endpoint` to `true` using the
`ForMember` method. This ensures that the `Active` property
is initialized to `true` during the mapping process, aligning
with the intended default behavior for new `Endpoint` objects.
This commit is contained in:
tekh 2025-12-03 12:43:51 +01:00
parent b67da5434e
commit 6e68083a8d
2 changed files with 3 additions and 2 deletions

View File

@ -37,7 +37,7 @@ public class RecActionController(IMediator mediator) : ControllerBase
CancellationToken cancel,
[FromBody] FakeRequest? request = null,
[FromQuery] string endpointUri = "https://jsonplaceholder.typicode.com/posts",
[FromQuery] string? endpointPath = null,
[FromQuery] string? endpointPath = "1",
[FromQuery] string type = "GET")
{
if (endpointPath is not null)

View File

@ -7,6 +7,7 @@ public class MappingProfile : AutoMapper.Profile
{
public MappingProfile()
{
CreateMap<ObtainEndpointCommand, Endpoint>();
CreateMap<ObtainEndpointCommand, Endpoint>()
.ForMember(e => e.Active, exp => exp.MapFrom(cmd => true));
}
}