Join our community: https://t.me/+DOylgFv1jyJlNzM0
Description
The notifications routes fetch all notifications for a user without pagination. As users accumulate notifications over time (loan updates, repayment reminders, governance alerts), the query will return an ever-growing response payload. A user with 10,000 notifications would receive all of them in a single API call.
Similar pagination was implemented for loans and remittances with cursor-based pagination, but notifications were not updated to match.
Expected Behavior
Apply the same cursor-based pagination pattern already used in getRemittances() to the notifications endpoint:
- Accept
?cursor=<timestamp> and ?limit=<n> query parameters
- Default to
limit=20, max limit=100
- Return a
nextCursor field in the response
- Add an index on
(user_id, created_at DESC) in the notifications table if not present
Impact
Medium. A high-activity user will experience slow notification loads and large payloads that degrade the API response time for the entire backend.
Description
The notifications routes fetch all notifications for a user without pagination. As users accumulate notifications over time (loan updates, repayment reminders, governance alerts), the query will return an ever-growing response payload. A user with 10,000 notifications would receive all of them in a single API call.
Similar pagination was implemented for loans and remittances with cursor-based pagination, but notifications were not updated to match.
Expected Behavior
Apply the same cursor-based pagination pattern already used in
getRemittances()to the notifications endpoint:?cursor=<timestamp>and?limit=<n>query parameterslimit=20, maxlimit=100nextCursorfield in the response(user_id, created_at DESC)in the notifications table if not presentImpact
Medium. A high-activity user will experience slow notification loads and large payloads that degrade the API response time for the entire backend.