From 6a7211cf67e965c23c4d74fcee46480d3f3bde01 Mon Sep 17 00:00:00 2001 From: Stuart Ferguson Date: Wed, 20 May 2026 16:23:11 +0100 Subject: [PATCH 1/2] Update file details mapping in FileImportHandler FileName now uses Path.GetFileName, and FileProfile is mapped to user-friendly names based on GUIDs. Removed redundant null check for result.Data. --- EstateReportingAPI/Handlers/FileImportHandler.cs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/EstateReportingAPI/Handlers/FileImportHandler.cs b/EstateReportingAPI/Handlers/FileImportHandler.cs index d36faf4..ab46325 100644 --- a/EstateReportingAPI/Handlers/FileImportHandler.cs +++ b/EstateReportingAPI/Handlers/FileImportHandler.cs @@ -50,11 +50,6 @@ public static async Task GetFileImportLog([FromHeader] Guid estateId, FileImportLogQueries.GetFileImportLogQuery query = new(estateId, merchantId, fileImportLogId); Result result = await mediator.Send(query, cancellationToken); - if (result.IsSuccess && result.Data == null) - { - return Results.NotFound(); - } - return ResponseFactory.FromResult(result, r => new DataTransferObjects.FileImportLog { FileImportLogId = r.FileImportLogId, @@ -63,8 +58,12 @@ public static async Task GetFileImportLog([FromHeader] Guid estateId, { DateTimeUploaded = fd.DateTimeUploaded, FileId = fd.FileId, - FileName = fd.FileName, - FileProfile = fd.FileProfile, + FileName = Path.GetFileName(fd.FileName), + FileProfile = fd.FileProfile.ToUpper() switch { + "B2A59ABF-293D-4A6B-B81B-7007503C3476" => "Safaricom Topup", + "8806EDBC-3ED6-406B-9E5F-A9078356BE99" => "Voucher Issue", + _ => "Unknown" + }, MerchantId = fd.MerchantId, MerchantName = fd.MerchantName, UploadedBy = fd.UploadedBy, From a37a5da32810484e27ae7450ec5960a654d1f3dc Mon Sep 17 00:00:00 2001 From: Stuart Ferguson Date: Wed, 20 May 2026 17:56:43 +0100 Subject: [PATCH 2/2] fix failing unit test --- EstateReportingAPI.BusinessLogic/ReportingManager.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/EstateReportingAPI.BusinessLogic/ReportingManager.cs b/EstateReportingAPI.BusinessLogic/ReportingManager.cs index 8f5e392..3b9986c 100644 --- a/EstateReportingAPI.BusinessLogic/ReportingManager.cs +++ b/EstateReportingAPI.BusinessLogic/ReportingManager.cs @@ -1489,6 +1489,9 @@ join fl in context.FileLines on f.FileId equals fl.FileId return ResultHelpers.CreateFailure(flatResult); var flatItems = flatResult.Data; + + if (flatItems.Count == 0) + return Result.NotFound(); var fileImportLogs = flatItems .GroupBy(x => new { x.FileImportLogId, x.ImportLogDateTime })