feat: remove subscription status as a visibility gate for agent profiles and include status in user service response

This commit is contained in:
pradeepkumar
2026-04-20 23:38:21 +05:30
parent 1541dba6e9
commit 360746c868
2 changed files with 6 additions and 9 deletions

View File

@@ -155,12 +155,8 @@ export class AgentsService {
return { ...profile, user: userWithoutPrefs }; return { ...profile, user: userWithoutPrefs };
} }
// Block access to non-paid agents (PAST_DUE included as grace period during Stripe retries) // Payment is no longer a visibility gate — admin-approved profiles are
const visibleStatuses = ['ACTIVE', 'TRIALING', 'PAST_DUE']; // visible regardless of subscription status.
if (!profile.subscriptionStatus || !visibleStatuses.includes(profile.subscriptionStatus)) {
throw new NotFoundException('Agent profile not found');
}
if (visibility === 'private') { if (visibility === 'private') {
throw new ForbiddenException('This profile is not available'); throw new ForbiddenException('This profile is not available');
} }
@@ -311,12 +307,11 @@ export class AgentsService {
const skip = (page - 1) * limit; const skip = (page - 1) * limit;
// Build where clause — only show active, admin-approved, paid subscribers in search // Build where clause — show all active, admin-approved profiles.
// PAST_DUE included as grace period (Stripe is retrying payment) // Subscription status is no longer a gate; admin can approve without payment.
const where: Prisma.AgentProfileWhereInput = { const where: Prisma.AgentProfileWhereInput = {
verificationStatus: 'APPROVED', verificationStatus: 'APPROVED',
user: { status: 'ACTIVE' }, user: { status: 'ACTIVE' },
subscriptionStatus: { in: ['ACTIVE', 'TRIALING', 'PAST_DUE'] },
}; };
if (search) { if (search) {

View File

@@ -299,6 +299,8 @@ export class UsersService {
verificationNote: user.agentProfile.verificationNote, verificationNote: user.agentProfile.verificationNote,
verifiedAt: user.agentProfile.verifiedAt, verifiedAt: user.agentProfile.verifiedAt,
verifiedBy: user.agentProfile.verifiedBy, verifiedBy: user.agentProfile.verifiedBy,
// Subscription / payment status (denormalized from AgentSubscription)
subscriptionStatus: user.agentProfile.subscriptionStatus,
}, },
}; };
} }