Join the discussion on Telegram
Why this matters
backend/src/controllers/stream.controller.ts lines 167-171:
const parsedLimit = Math.min(
typeof limit === 'string' ? (Number.parseInt(limit, 10) || 20) : 20,
100
);
The 20 default and 100 cap are unexplained inline magic. The events listing in the same file (line 282-285) uses different magic numbers (50 default, 500 cap). The user-events controller (backend/src/controllers/user.controller.ts:80-82) uses yet another (50 default, 200 cap). Three pagination tunables — none named.
Acceptance criteria
Files to touch
backend/src/controllers/stream.controller.ts (lines 167-171, 282-285)
backend/src/controllers/user.controller.ts (lines 80-82)
Out of scope
- Introducing a shared pagination middleware
Join the discussion on Telegram
Why this matters
backend/src/controllers/stream.controller.tslines 167-171:The
20default and100cap are unexplained inline magic. The events listing in the same file (line 282-285) uses different magic numbers (50default,500cap). The user-events controller (backend/src/controllers/user.controller.ts:80-82) uses yet another (50default,200cap). Three pagination tunables — none named.Acceptance criteria
DEFAULT_STREAM_PAGE_SIZE = 20,MAX_STREAM_PAGE_SIZE = 100at module scope instream.controller.tsDEFAULT_EVENTS_PAGE_SIZE,MAX_EVENTS_PAGE_SIZE) and the user-events controllerMAX_EVENT_LIMIT/DEFAULT_EVENT_LIMITalready declared inroutes/v1/events.routes.ts:24-25for consistencyFiles to touch
backend/src/controllers/stream.controller.ts(lines 167-171, 282-285)backend/src/controllers/user.controller.ts(lines 80-82)Out of scope