Fix admin IAM redirect and separate pending wholesale lists.

Keep admin browser bootstrap from falling back to the customer app URL, and exclude activated customers from the pending-verification list so it no longer mirrors the main omde grid.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
s.esmaeili
2026-10-25 22:44:48 +03:30
co-authored by Cursor
parent 55d27151c9
commit 6592e88a2c
7 changed files with 85 additions and 17 deletions
@@ -246,13 +246,25 @@ export class AdminCustomersService {
* customer -> type=2 AND is_archive=0 (مغازه دار اپلیکیشن)
* banker -> type=4 AND is_archive=0 (بنکدار)
* shopkeeper -> type=3 AND is_archive=0 (مغازه دار حضوری)
* major/verify/table -> is_archive=0 AND (step_one=1 OR step_two=1)
* major/verify/table -> awaiting first approval (inactive + step pending)
* major/archive/table -> is_archive=1 (no type filter)
*
* 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.
*/
private scopeWhere(scope: OmdeScope): Prisma.CustomerWhereInput {
const pendingVerification: Prisma.CustomerWhereInput = {
isActive: false,
verificationStep: {
in: [VerificationStep.STEP_ONE_SUBMITTED, VerificationStep.STEP_TWO_SUBMITTED],
},
};
switch (scope) {
case 'banker':
return { kind: CustomerKind.BANKER, isArchived: false };
@@ -261,18 +273,17 @@ export class AdminCustomersService {
// the main omde list, not this one.
return { kind: CustomerKind.WALK_IN_SHOPKEEPER, isArchived: false };
case 'non_verified':
return {
isArchived: false,
verificationStep: {
in: [VerificationStep.STEP_ONE_SUBMITTED, VerificationStep.STEP_TWO_SUBMITTED],
},
};
return { isArchived: false, ...pendingVerification };
case 'archived':
return { isArchived: true };
case 'all':
default:
// legacy getCustomer is type=2 + is_archive=0 — not an unfiltered list.
return { kind: CustomerKind.APP_SHOPKEEPER, isArchived: false };
// type=2 + not archived, and not sitting in «در انتظار».
return {
kind: CustomerKind.APP_SHOPKEEPER,
isArchived: false,
NOT: pendingVerification,
};
}
}