From 4d6183fa24d18c7b4e51246d0e852db68c8c6ecb Mon Sep 17 00:00:00 2001 From: Sepehr Yahyaee Date: Fri, 19 Jun 2026 14:24:57 +0330 Subject: [PATCH] Inquiry fix --- src/sand-hub/sand-hub.service.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/sand-hub/sand-hub.service.ts b/src/sand-hub/sand-hub.service.ts index fee0119..1bc6444 100644 --- a/src/sand-hub/sand-hub.service.ts +++ b/src/sand-hub/sand-hub.service.ts @@ -449,11 +449,16 @@ export class SandHubService { }; } - const data = raw?.data ?? {}; + // Real ESG response wraps payload in { success: true, data: { ... } }. + // Mock data and Tejarat-format fallback are flat objects with no .data wrapper — + // in that case use raw itself so CompanyName / CompanyCode are preserved. + const data = + raw?.data != null && typeof raw?.data === "object" ? raw.data : raw; return this.mapNewApiResponseToOldFormat({ ...data, - companyId: data.CmpCod ?? data.companyId, - companyPersianName: data.CmpNam ?? data.companyPersianName, + companyId: data.CmpCod ?? data.companyId ?? data.CompanyCode, + companyPersianName: + data.CmpNam ?? data.companyPersianName ?? data.CompanyName, carGrpCod: data.CarGrpCod ?? data.carGrpCod, usgCod: data.UsgCod ?? data.usgCod, vehSysCod: data.VehSysCod ?? data.vehSysCod,