From 36da9823869b757128daeff5eef61f0946c862fa Mon Sep 17 00:00:00 2001 From: Ho Ngoc Hai Date: Sat, 28 Feb 2026 22:53:38 +0700 Subject: [PATCH] fix(merchant-service): resolve MapToDetailDto NullRef on shop detail API - Add null-safe access for Type, Category, Status, ContactInfo, Branches - Fixes 500 error when loading shop details in admin UI --- .../Queries/Shops/GetShopsQueryHandler.cs | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/services/merchant-service-net/src/MerchantService.API/Application/Queries/Shops/GetShopsQueryHandler.cs b/services/merchant-service-net/src/MerchantService.API/Application/Queries/Shops/GetShopsQueryHandler.cs index 5fa1e7fb..300d02f0 100644 --- a/services/merchant-service-net/src/MerchantService.API/Application/Queries/Shops/GetShopsQueryHandler.cs +++ b/services/merchant-service-net/src/MerchantService.API/Application/Queries/Shops/GetShopsQueryHandler.cs @@ -88,30 +88,30 @@ public class GetShopByIdQueryHandler : IRequestHandler d.ToString()).ToList() + OpenDays = shop.OperatingHours.OpenDays?.Select(d => d.ToString()).ToList() ?? new() } : null, - Branches = shop.Branches.Select(b => new ShopBranchDto + Branches = shop.Branches?.Select(b => new ShopBranchDto { Id = b.Id, Name = b.Name, Code = b.Code, - Address = new AddressDto + Address = b.Address != null ? new AddressDto { Street = b.Address.Street, Ward = b.Address.Ward, @@ -119,7 +119,7 @@ public class GetShopByIdQueryHandler : IRequestHandler