diff --git a/apps/api/release/app.js b/apps/api/release/app.js index 2d6c2b5..c427f2b 100644 --- a/apps/api/release/app.js +++ b/apps/api/release/app.js @@ -97157,10 +97157,9 @@ var require_admin_customers_service = __commonJS({ * NOTE every non-archive list also excludes archived rows, so archiving a * customer removes them from ALL type lists at once. * - * «در انتظار» vs «عمده» must not show the same rows. App self-registration - * creates APP_SHOPKEEPER + isActive=false + STEP_ONE_SUBMITTED, and step-one - * accept sets isActive=true — so pending is inactive+pending-step only, and - * the main omde list excludes those same inactive pending rows. + * «در انتظار» and «عمده» MAY show the same customer, exactly as in the + * reference: getCustomer has no verification filter, so a customer awaiting + * approval is in both lists. */ scopeWhere(scope) { const pendingVerification = { @@ -97186,8 +97185,7 @@ var require_admin_customers_service = __commonJS({ return { kind: client_1.CustomerKind.APP_SHOPKEEPER, isArchived: false, - ...notExpertTradingAccount, - NOT: pendingVerification + ...notExpertTradingAccount }; } } diff --git a/apps/api/src/modules/admin-customers/admin-customers.service.spec.ts b/apps/api/src/modules/admin-customers/admin-customers.service.spec.ts index 905c3c1..8bf5b1d 100644 --- a/apps/api/src/modules/admin-customers/admin-customers.service.spec.ts +++ b/apps/api/src/modules/admin-customers/admin-customers.service.spec.ts @@ -99,4 +99,15 @@ describe('AdminCustomersService', () => { expect(writes[0].passwordHash).toBe(OTP_ONLY_PASSWORD_HASH); }); }); + describe('wholesale list scope (parity with AdminController::getCustomer)', () => { + const scope = (name: 'all' | 'non_verified') => + (build().service as unknown as { scopeWhere(s: string): Record }).scopeWhere(name); + + it('«عمده» has no verification or active filter — pending customers stay listed', () => { + const where = scope('all'); + expect(where).toEqual({ kind: 'APP_SHOPKEEPER', isArchived: false, salesExpertTradingFor: null }); + expect(JSON.stringify(where)).not.toContain('verificationStep'); + expect(JSON.stringify(where)).not.toContain('isActive'); + }); + }); }); 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 22108da..2b806aa 100644 --- a/apps/api/src/modules/admin-customers/admin-customers.service.ts +++ b/apps/api/src/modules/admin-customers/admin-customers.service.ts @@ -252,10 +252,9 @@ export class AdminCustomersService { * NOTE every non-archive list also excludes archived rows, so archiving a * customer removes them from ALL type lists at once. * - * «در انتظار» vs «عمده» must not show the same rows. App self-registration - * creates APP_SHOPKEEPER + isActive=false + STEP_ONE_SUBMITTED, and step-one - * accept sets isActive=true — so pending is inactive+pending-step only, and - * the main omde list excludes those same inactive pending rows. + * «در انتظار» and «عمده» MAY show the same customer, exactly as in the + * reference: getCustomer has no verification filter, so a customer awaiting + * approval is in both lists. */ private scopeWhere(scope: OmdeScope): Prisma.CustomerWhereInput { const pendingVerification: Prisma.CustomerWhereInput = { @@ -284,12 +283,15 @@ export class AdminCustomersService { return { isArchived: true, ...notExpertTradingAccount }; case 'all': default: - // type=2 + not archived, not «در انتظار», not an expert's trading row. + // type=2 + not archived (AdminController::getCustomer:166-168), minus an + // expert's trading row. NO verification/active filter: the reference + // lists every non-archived type-2 customer, pending ones included, and + // only counts the inactive ones separately. Filtering them out here + // emptied the list for customers migrated with a pending step. return { kind: CustomerKind.APP_SHOPKEEPER, isArchived: false, ...notExpertTradingAccount, - NOT: pendingVerification, }; } }