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

@@ -78,6 +78,7 @@ export class PrismaPropertyRepository implements IPropertyRepository {
const mediaList = await this.prisma.propertyMedia.findMany({
where: { propertyId },
orderBy: { order: 'asc' },
take: 50,
});
return mediaList.map((m) => this.toMediaDomain(m));
}