diff --git a/src/Application/Features/Transfers/Commands/ProcessIncomingTransfer.cs b/src/Application/Features/Transfers/Commands/ProcessIncomingTransfer.cs index 92f7f3f2..08bca848 100644 --- a/src/Application/Features/Transfers/Commands/ProcessIncomingTransfer.cs +++ b/src/Application/Features/Transfers/Commands/ProcessIncomingTransfer.cs @@ -21,7 +21,7 @@ class Handler(IUnitOfWork unitOfWork) : IRequestHandler public async Task Handle(Command request, CancellationToken cancellationToken) { var participant = await unitOfWork.DbContext.Participants - .FindAsync([request.IncomingTransfer.Participant.Id], cancellationToken); + .FindAsync([request.IncomingTransfer.ParticipantId], cancellationToken); var transfer = await unitOfWork.DbContext.ParticipantIncomingTransferQueue .FindAsync([request.IncomingTransfer.Id], cancellationToken); diff --git a/src/Application/Features/Transfers/DTOs/IncomingTransferDto.cs b/src/Application/Features/Transfers/DTOs/IncomingTransferDto.cs index 8f777a0a..b82bf46d 100644 --- a/src/Application/Features/Transfers/DTOs/IncomingTransferDto.cs +++ b/src/Application/Features/Transfers/DTOs/IncomingTransferDto.cs @@ -7,7 +7,12 @@ namespace Cfo.Cats.Application.Features.Transfers.DTOs; public class IncomingTransferDto { public required Guid Id { get; set; } - public required ParticipantDto Participant { get; set; } + + + public required string ParticipantFullName { get; set; } + public required string ParticipantId { get; set; } + + //public required ParticipantDto Participant { get; set; } public string? FromContractId { get; set; } public string? ToContractId { get; set; } public required LocationDto FromLocation { get; set; } @@ -20,7 +25,9 @@ class Mapper : Profile { public Mapper() { - CreateMap(); + CreateMap() + .ForMember(p => p.ParticipantId, options => options.MapFrom(src => src.ParticipantId)) + .ForMember(p => p.ParticipantFullName, options => options.MapFrom(src => src.Participant!.FirstName + " " + src.Participant!.LastName)); } } } diff --git a/src/Application/Features/Transfers/DTOs/OutgoingTransferDto.cs b/src/Application/Features/Transfers/DTOs/OutgoingTransferDto.cs index b7c051c8..d52e1132 100644 --- a/src/Application/Features/Transfers/DTOs/OutgoingTransferDto.cs +++ b/src/Application/Features/Transfers/DTOs/OutgoingTransferDto.cs @@ -8,7 +8,6 @@ namespace Cfo.Cats.Application.Features.Transfers.DTOs; public class OutgoingTransferDto { public required Guid Id { get; set; } - public required ParticipantDto Participant { get; set; } public string? FromContractId { get; set; } public string? ToContractId { get; set; } public required LocationDto FromLocation { get; set; } @@ -16,11 +15,16 @@ public class OutgoingTransferDto public required DateTime MoveOccured { get; set; } public required TransferLocationType TransferType { get; set; } + public required string ParticipantId { get; set; } + public required string ParticipantFullName { get; set; } + class Mapper : Profile { public Mapper() { - CreateMap(); + CreateMap() + .ForMember(t => t.ParticipantId, options => options.MapFrom(source => source.ParticipantId)) + .ForMember(t => t.ParticipantFullName, options => options.MapFrom(source => source.Participant!.FirstName + " " + source.Participant.LastName)); } } } diff --git a/src/Server.UI/Pages/Transfers/Components/ProcessTransferDialog.razor b/src/Server.UI/Pages/Transfers/Components/ProcessTransferDialog.razor index c49dd41a..be055ac7 100644 --- a/src/Server.UI/Pages/Transfers/Components/ProcessTransferDialog.razor +++ b/src/Server.UI/Pages/Transfers/Components/ProcessTransferDialog.razor @@ -67,7 +67,7 @@ var owner = await GetNewMediator().Send(new GetOwnerByParticipantId.Query() { - ParticipantId = Model.IncomingTransfer.Participant.Id + ParticipantId = Model.IncomingTransfer.ParticipantId }); if (owner is { Succeeded: true, Data: not null }) diff --git a/src/Server.UI/Pages/Transfers/Transfers.razor b/src/Server.UI/Pages/Transfers/Transfers.razor index 43978f06..7e1633b4 100644 --- a/src/Server.UI/Pages/Transfers/Transfers.razor +++ b/src/Server.UI/Pages/Transfers/Transfers.razor @@ -28,8 +28,8 @@
- @context.Participant.FullName - @context.Participant.Id + @context.ParticipantFullName + @context.ParticipantId
@@ -67,8 +67,8 @@
- @context.Participant.FullName - @context.Participant.Id + @context.ParticipantFullName + @context.ParticipantId
@@ -154,6 +154,6 @@ } } - private void View(OutgoingTransferDto transfer) => Navigation.NavigateTo($"/pages/participants/{transfer.Participant.Id}"); + private void View(OutgoingTransferDto transfer) => Navigation.NavigateTo($"/pages/participants/{transfer.ParticipantId}"); }