TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Praashh/buildml/llms.txt
Use this file to discover all available pages before exploring further.
userRouter provides four procedures for community statistics, competitive ranking, and personal progress data. getAllUsers, getLeaderboard, and getProfile are public and can be called without authentication. getUserRank requires an active session to identify which user’s rank to compute.
All leaderboard and rank calculations derive solvedCount from distinct problemIds with status = "PASS" — a user who submits the same problem multiple times is only counted once.
user.getAllUsers
Returns the total number of registered users on the platform. Useful for social proof displays (“Join 1,200 developers solving ML challenges”).
Type: query — Auth: public
Input: none
Response
Total count of
User rows in the database, as returned by Prisma’s user.count().user.getLeaderboard
Returns all users ranked by the number of unique problems they have solved with a PASS status, sorted descending. Anonymous users (no name set) are displayed as "Anonymous".
Type: query — Auth: public
Input: none
Response
An array of user rank objects, sorted bysolvedCount descending:
Unique CUID identifier of the user.
Display name of the user. Falls back to
"Anonymous" if the user has no name set.URL of the user’s profile/avatar image.
null if not set.Count of distinct problems the user has solved with
status = "PASS". Duplicates across multiple passing submissions for the same problem are collapsed.user.getUserRank
Returns the 1-based leaderboard rank of the currently authenticated user. Rank is determined by sorting all users by solvedCount descending and finding the authenticated user’s position.
Type: query — Auth: protected (session required)
Input: none
Response
The authenticated user’s 1-based leaderboard position, or
null if the user is not found in the ranked list (e.g., they have no passing submissions).user.getProfile
Fetches a detailed profile for any user, including per-difficulty solved counts, total available problems per difficulty, overall solved count, and a daily submission activity history map. If userId is omitted, the current session user’s profile is returned.
Type: query — Auth: public
Input: { userId?: string }
The CUID of the user whose profile to fetch. If omitted, the procedure falls back to
ctx.session?.user?.id. Returns null if neither is available.Response
Returnsnull if the resolved userId is not found. Otherwise returns:
Basic identity fields for the profile owner.
Number of unique problems the user has solved at each difficulty level. A problem is counted once regardless of how many passing submissions exist for it.
Total number of problems available on the platform at each difficulty level, derived from
prisma.problem.groupBy. Used to render progress bars (e.g., “3 / 10 Easy solved”).Total number of unique problems the user has solved across all difficulty levels (
Easy + Medium + Hard).A map of
YYYY-MM-DD date strings to the number of passing submissions made on that day. Used to render activity heatmap / contribution graphs.