fix: treat Tahesab no-records as an empty customer list instead of a 502
Listing all customers no longer fails on the final empty code range, and importing a missing code no longer creates a placeholder person.
This commit is contained in:
@@ -507,7 +507,13 @@ export class TahesabPersonLinkService {
|
||||
dto.moshtariCode,
|
||||
dto.moshtariCode,
|
||||
);
|
||||
row = (asMoshtariList(raw)[0] ?? {}) as Record<string, unknown>;
|
||||
const found = asMoshtariList(raw)[0];
|
||||
if (!found) {
|
||||
throw new NotFoundException(
|
||||
`مشتری با کد ${dto.moshtariCode} در تهحساب یافت نشد.`,
|
||||
);
|
||||
}
|
||||
row = found as Record<string, unknown>;
|
||||
}
|
||||
const name = pickName(row) || `مشتری تهحساب ${dto.moshtariCode}`;
|
||||
const tel = pickTel(row);
|
||||
|
||||
Reference in New Issue
Block a user