Exclude sales-expert trading accounts from wholesale customer lists.

Expert trading rows are APP_SHOPKEEPER for orders/ledger and were showing next to real omde customers.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
s.esmaeili
2026-10-25 23:16:13 +03:30
co-authored by Cursor
parent 066bfd2818
commit 4679e2498c
2 changed files with 16 additions and 5 deletions
+6 -2
View File
@@ -97169,20 +97169,24 @@ var require_admin_customers_service = __commonJS({
in: [client_1.VerificationStep.STEP_ONE_SUBMITTED, client_1.VerificationStep.STEP_TWO_SUBMITTED]
}
};
const notExpertTradingAccount = {
salesExpertTradingFor: null
};
switch (scope) {
case "banker":
return { kind: client_1.CustomerKind.BANKER, isArchived: false };
case "shopkeeper":
return { kind: client_1.CustomerKind.WALK_IN_SHOPKEEPER, isArchived: false };
case "non_verified":
return { isArchived: false, ...pendingVerification };
return { isArchived: false, ...pendingVerification, ...notExpertTradingAccount };
case "archived":
return { isArchived: true };
return { isArchived: true, ...notExpertTradingAccount };
case "all":
default:
return {
kind: client_1.CustomerKind.APP_SHOPKEEPER,
isArchived: false,
...notExpertTradingAccount,
NOT: pendingVerification
};
}
@@ -264,6 +264,12 @@ export class AdminCustomersService {
in: [VerificationStep.STEP_ONE_SUBMITTED, VerificationStep.STEP_TWO_SUBMITTED],
},
};
// A sales expert is an AdminUser; their trading Customer row exists only so
// the app can hold orders/ledger for them (D21). It must not appear next to
// real wholesale customers in «عمده» / «در انتظار».
const notExpertTradingAccount: Prisma.CustomerWhereInput = {
salesExpertTradingFor: null,
};
switch (scope) {
case 'banker':
@@ -273,15 +279,16 @@ export class AdminCustomersService {
// the main omde list, not this one.
return { kind: CustomerKind.WALK_IN_SHOPKEEPER, isArchived: false };
case 'non_verified':
return { isArchived: false, ...pendingVerification };
return { isArchived: false, ...pendingVerification, ...notExpertTradingAccount };
case 'archived':
return { isArchived: true };
return { isArchived: true, ...notExpertTradingAccount };
case 'all':
default:
// type=2 + not archived, and not sitting in «در انتظار».
// type=2 + not archived, not «در انتظار», not an expert's trading row.
return {
kind: CustomerKind.APP_SHOPKEEPER,
isArchived: false,
...notExpertTradingAccount,
NOT: pendingVerification,
};
}