feat: Filter agent profiles by verificationStatus: 'APPROVED' in search, featured, and top-rated listings.

This commit is contained in:
pradeepkumar
2026-03-14 14:00:06 +05:30
parent c431c751e8
commit 4e602abf49

View File

@@ -196,8 +196,10 @@ export class AgentsService {
const skip = (page - 1) * limit; const skip = (page - 1) * limit;
// Build where clause // Build where clause — only show admin-approved profiles in search
const where: Prisma.AgentProfileWhereInput = {}; const where: Prisma.AgentProfileWhereInput = {
verificationStatus: 'APPROVED',
};
if (search) { if (search) {
where.OR = [ where.OR = [
@@ -458,6 +460,7 @@ export class AgentsService {
where: { where: {
isVerified: true, isVerified: true,
isFeatured: true, isFeatured: true,
verificationStatus: 'APPROVED',
}, },
take: limit, take: limit,
orderBy: [{ averageRating: 'desc' }, { totalReviews: 'desc' }], orderBy: [{ averageRating: 'desc' }, { totalReviews: 'desc' }],
@@ -481,6 +484,7 @@ export class AgentsService {
where: { where: {
isVerified: true, isVerified: true,
totalReviews: { gte: 5 }, totalReviews: { gte: 5 },
verificationStatus: 'APPROVED',
}, },
take: limit, take: limit,
orderBy: [{ averageRating: 'desc' }, { totalReviews: 'desc' }], orderBy: [{ averageRating: 'desc' }, { totalReviews: 'desc' }],