From 4679e2498c254c8f97d5d5cd7c779177a2f0e27c Mon Sep 17 00:00:00 2001 From: "s.esmaeili" Date: Sun, 25 Oct 2026 23:16:13 +0330 Subject: [PATCH] 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 --- apps/api/release/app.js | 8 ++++++-- .../admin-customers/admin-customers.service.ts | 13 ++++++++++--- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/apps/api/release/app.js b/apps/api/release/app.js index 46b41ae..fe42a63 100644 --- a/apps/api/release/app.js +++ b/apps/api/release/app.js @@ -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 }; } diff --git a/apps/api/src/modules/admin-customers/admin-customers.service.ts b/apps/api/src/modules/admin-customers/admin-customers.service.ts index f91b14b..22108da 100644 --- a/apps/api/src/modules/admin-customers/admin-customers.service.ts +++ b/apps/api/src/modules/admin-customers/admin-customers.service.ts @@ -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, }; }