Data Layer low complexity backend
0
Dependencies
1
Dependents
2
Entities
0
Integrations

Description

Data access layer for role assignments. Handles reads and writes to the user_roles and user_role_assignments tables in PostgreSQL, including transactional updates to roles_updated_at for JWT invalidation.

Feature: Role Assignment

role-assignment-repository

Responsibilities

  • CRUD operations on user_role_assignments table
  • Query available roles from user_roles table
  • Transactional update of roles_updated_at timestamp with role change
  • Fetch role assignment history for audit display

Interfaces

findRolesByUserId(userId: string): Promise<UserRole[]>
createAssignment(assignment: RoleAssignment): Promise<RoleAssignment>
deleteAssignment(userId: string, roleId: string): Promise<void>
findAllRoles(): Promise<Role[]>
updateRolesTimestamp(userId: string): Promise<void>
findAssignmentHistory(userId: string, limit: number): Promise<RoleChangeLog[]>

Relationships

Dependents (1)

Components that depend on this component

Related Data Entities (2)

Data entities managed by this component