fix(db): add missing indexes, bound unbounded queries, parallelize admin queries

- Add 7 missing indexes: User(kycStatus, isActive, createdAt),
  Listing(createdAt, featuredUntil, expiresAt), Payment(createdAt)
- Add take:50 limit to unbounded findMediaByPropertyId and findByPropertyId
- Parallelize sequential queries in getUserDetail with Promise.all

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Ho Ngoc Hai
2026-04-08 13:10:39 +07:00
parent 5848c2b386
commit 91ef71d5e1
4 changed files with 25 additions and 15 deletions

View File

@@ -17,6 +17,7 @@ export class PrismaValuationRepository implements IValuationRepository {
const records = await this.prisma.valuation.findMany({
where: { propertyId },
orderBy: { createdAt: 'desc' },
take: 50,
});
return records.map((r) => this.toDomain(r));
}