What
When courseId is undefined (the "all courses" path), the function executes a DISTINCT ON (course_id) query that returns all courses for the learner without applying LIMIT or OFFSET. The pagination parameters are silently discarded.
Why
A learner with hundreds of courses would return all records in a single response, causing large payloads and potential memory/performance issues. The API at routes.ts:100-105 passes limit and offset through to this function, giving callers the false impression pagination is supported.
Scope
- Apply limit and offset to the DISTINCT ON query
- Or document that pagination is not supported for this path
Acceptance Criteria
Technical Context
- File:
src/database/queries.ts, lines 164-172
What
When
courseIdisundefined(the "all courses" path), the function executes aDISTINCT ON (course_id)query that returns all courses for the learner without applyingLIMITorOFFSET. The pagination parameters are silently discarded.Why
A learner with hundreds of courses would return all records in a single response, causing large payloads and potential memory/performance issues. The API at
routes.ts:100-105passeslimitandoffsetthrough to this function, giving callers the false impression pagination is supported.Scope
Acceptance Criteria
Technical Context
src/database/queries.ts, lines 164-172