Role Repository
Component Detail
Data Layer
low complexity
backend
0
Dependencies
1
Dependents
3
Entities
0
Integrations
Description
Data access layer for reading role definitions and reading/writing user role assignments. Provides typed queries against the user_roles and user_role_assignments tables with transaction support for atomic role changes.
role-repository
Responsibilities
- Query all roles currently assigned to a given user
- Insert and delete records in user_role_assignments
- Update the roles_updated_at field on the users table to trigger JWT re-validation
- List all available role definitions from user_roles
Interfaces
findRolesByUserId(userId): Promise<Role[]>
assignRole(userId, roleId): Promise<void>
revokeRole(userId, roleId): Promise<void>
listRoles(): Promise<Role[]>
updateRolesTimestamp(userId): Promise<void>
Relationships
Related Data Entities (3)
Data entities managed by this component