perf: add select clause to admin review query, exclude large TEXT columns
All checks were successful
Deploy API Server / build-and-deploy (push) Successful in 41s

- Only fetch display-needed columns, skip backText TEXT column
- Reduces data transfer and query time significantly

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
WangDL 2026-05-24 19:55:40 +08:00
parent 8a6b103571
commit f599af1b3c

View File

@ -31,12 +31,15 @@ export class AdminReviewController {
where.frontText = { contains: search };
}
const select = {
id: true, userId: true, frontText: true, difficulty: true,
status: true, scheduleState: true, intervalDays: true,
repetitionCount: true, lapseCount: true, nextReviewAt: true,
};
const [items, total] = await Promise.all([
this.prisma.reviewCard.findMany({
where,
orderBy: { createdAt: 'desc' },
take,
skip,
where, orderBy: { createdAt: 'desc' }, take, skip, select,
}),
this.prisma.reviewCard.count({ where }),
]);