You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add pagination to admin user activity endpoint #539
The getUserActivity method in src/modules/admin/admin-users.service.ts (lines 267-357) queries multiple tables without pagination, returning ALL activity records for a user. For long-tenured users, this could return thousands of records.
asyncgetUserActivity(userId: string): Promise<Array<{type: string;title: string;timestamp: Date;details: Record<string,unknown>;}>>{// Fetch all activity sources - NO PAGINATIONconst[enrollmentRows,submissionRows,credentialRows]=awaitPromise.all([db.select()...from(enrollments)...where(eq(enrollments.userId,userId)),db.select()...from(quizSubmissions)...where(eq(quizSubmissions.userId,userId)),db.select()...from(credentials)...where(eq(credentials.userId,userId)),]);// ... combines all and sorts}
The Problem
No pagination - returns ALL records
For active users, this could be hundreds of enrollments, thousands of quiz submissions
The response is unbounded and could be very large
No limit on the number of records returned from each table
Combines all results in memory, sorts, and returns everything
Recommended Fix
Add pagination parameters and limit the query:
asyncgetUserActivity(userId: string,page: number=1,limit: number=50): Promise<{activities: Activity[];total: number}>{constoffset=(page-1)*limit;// Use UNION ALL query or limit each source// ... with pagination}
Acceptance Criteria
Add pagination parameters (page, limit) to the method
Limit the number of records returned from each table
Return total count for pagination metadata
Consider using a UNION ALL query for efficiency
Severity
medium - Performance issue that could cause timeouts or memory issues for active users.
I can tackle Add pagination to admin user activity endpoint. Proposed implementation roadmap:
Analysis: Inspect current behavior and edge cases in ChainLearnOfficial/chainlearn-api
Core Implementation: Build out the handlers for Add pagination to admin user activity endpoint ensuring proper HTTP status codes and error propagation.
Quality Assurance: Verify API response schemas, authentication middleware, and database rollback safety.
I am ready to start immediately—please feel free to assign this to me!
Activity
guptakumarranjeet150 commentedon Sep 30, 2026
Hey maintainers,
I can tackle
Add pagination to admin user activity endpoint. Proposed implementation roadmap:ChainLearnOfficial/chainlearn-apiAdd pagination to admin user activity endpointensuring proper HTTP status codes and error propagation.I am ready to start immediately—please feel free to assign this to me!
samueldoo commentedon Sep 30, 2026
Hi Maintainers, I’d like to work on resolving this issue.