Skip to content

perf: replace in-memory pagination with DB-level keyset queries#916

Merged
LaGodxy merged 2 commits into
StarkMindsHQ:mainfrom
Tobi-8:perf/db-level-pagination-and-module-wiring
Apr 29, 2026
Merged

perf: replace in-memory pagination with DB-level keyset queries#916
LaGodxy merged 2 commits into
StarkMindsHQ:mainfrom
Tobi-8:perf/db-level-pagination-and-module-wiring

Conversation

@Tobi-8

@Tobi-8 Tobi-8 commented Apr 29, 2026

Copy link
Copy Markdown
Contributor
  • Add findPaginated(limit, afterId) to user and course repositories using WHERE id > :afterId LIMIT n+1 keyset pattern
  • Update findBySearchTerm, findByCategory, findByDifficulty, findByCategoryAndDifficulty to accept limit/afterId params
  • Rewrite ListUsersUseCase and ListCoursesUseCase to delegate pagination to the repository instead of slicing in memory
  • Add USER_REPOSITORY and COURSE_REPOSITORY string tokens for NestJS DI (interfaces cannot be used as runtime tokens)
  • Wire use cases, repositories, mappers, and persistence entities into UserModule and CourseModule providers
  • Add safety take(1000) cap on raw findAll() calls
  • Remove unreachable throw in auth.service.ts resetPassword

closes #783

- Add findPaginated(limit, afterId) to user and course repositories
  using WHERE id > :afterId LIMIT n+1 keyset pattern
- Update findBySearchTerm, findByCategory, findByDifficulty,
  findByCategoryAndDifficulty to accept limit/afterId params
- Rewrite ListUsersUseCase and ListCoursesUseCase to delegate
  pagination to the repository instead of slicing in memory
- Add USER_REPOSITORY and COURSE_REPOSITORY string tokens for
  NestJS DI (interfaces cannot be used as runtime tokens)
- Wire use cases, repositories, mappers, and persistence entities
  into UserModule and CourseModule providers
- Add safety take(1000) cap on raw findAll() calls
- Remove unreachable throw in auth.service.ts resetPassword
@drips-wave

drips-wave Bot commented Apr 29, 2026

Copy link
Copy Markdown

@Tobi-8 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@LaGodxy
LaGodxy merged commit 0ea534d into StarkMindsHQ:main Apr 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Performance Tuning Guide

2 participants