Merge pull request 'Inquiry fix' (#135) from s.yahyaee/yara724-api:main into main

Reviewed-on: Yara724/api#135
This commit is contained in:
2026-06-19 14:26:42 +03:30

View File

@@ -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,