Skip to main content
The Users router handles user profiles, role management, and user queries.

Procedures

getProfile

Type: Query
Authentication: Protected
Get user profile information.
userId
string
User ID to fetch (defaults to current user)
id
string
User ID
name
string
User name
email
string
User email
image
string
Profile image URL
role
array
Array of user roles
DH12Application
object
Application information if exists
DH12Application.id
string
Application ID
DH12Application.firstName
string
First name
DH12Application.lastName
string
Last name
DH12Application.socialText
string[]
Social media links
DH12Application.studyLocation
string
School/university
DH12Application.studyDegree
string
Degree program
DH12Application.studyYearOfStudy
string
Year of study
DH12Application.studyMajor
string
Major
DH12Application.status
enum
Application status
Example:
// Get current user's profile
const profile = await trpc.users.getProfile.useQuery();

// Get specific user's profile
const otherProfile = await trpc.users.getProfile.useQuery("user123");

checkIn

Type: Mutation
Authentication: Protected (ADMIN role required)
Check in a user (update their application status to CHECKED_IN).
userId
string
required
User ID to check in
Example:
await trpc.users.checkIn.mutate("user123");

byRole

Type: Query
Authentication: Protected (ADMIN role required)
Get paginated list of users filtered by role.
role
enum
Filter by role (null for all users)
page
number
required
Page number (minimum 1, default 1)
limit
number
required
Results per page (minimum 1, default 10)
searchName
string
Search by name or email
users
array
Array of user objects
totalCount
number
Total number of users matching criteria
Example:
const result = await trpc.users.byRole.useQuery({
  role: "JUDGE",
  page: 1,
  limit: 20,
  searchName: "john"
});
// Returns: { users: [...], totalCount: 45 }

addRole

Type: Mutation
Authentication: Protected (ADMIN role required)
Add a role to a user.
id
string
required
User ID (CUID format)
role
enum
required
Role to add (ADMIN, REVIEWER, JUDGE, GENERAL_SCANNER, FOOD_MANAGER, EVENT_MANAGER, etc.)
Example:
await trpc.users.addRole.mutate({
  id: "user123",
  role: "JUDGE"
});

removeRole

Type: Mutation
Authentication: Protected (ADMIN role required)
Remove a role from a user.
id
string
required
User ID (CUID format)
role
enum
required
Role to remove
Example:
await trpc.users.removeRole.mutate({
  id: "user123",
  role: "JUDGE"
});

Available Roles

The following roles are available in the system:
  • ADMIN - Full administrative access
  • REVIEWER - Can review applications
  • JUDGE - Can judge projects
  • GENERAL_SCANNER - Can scan QR codes at all stations
  • FOOD_MANAGER - Can manage food station scans
  • EVENT_MANAGER - Can manage event station scans

Build docs developers (and LLMs) love