Data Layer medium complexity backend
0
Dependencies
0
Dependents
3
Entities
0
Integrations

Description

Handles all database read and write operations for user records scoped to a specific tenant. Provides typed query methods used by AdminUserService and ensures no cross-tenant data leakage through mandatory tenant filter injection. Manages soft-delete (deactivation) and hard-delete lifecycles.

Feature: User CRUD

admin-user-repository

Sources & reasoning

Lines 325-328 explicitly place Brukeradministrasjon (invite, deactivate, role assignment) in the Admin Web Portal MVP scope. Without user CRUD the organization cannot onboard any peer mentors or coordinators, making the platform non-functional. It is the prerequisite for all other admin portal capabilities and directly referenced in the Phase 1 MVP deliverables.

  • docs/source/likeperson.md · line 325-328
    - Brukeradministrasjon (invitere, deaktivere, rolletildeling)

Responsibilities

  • Query users by tenant with support for pagination, search, and status filters
  • Insert new pending user records created by the invitation flow
  • Update user profile fields and role assignments atomically
  • Mark users as deactivated (soft delete) or remove records permanently (hard delete)
  • Enforce tenantId filter on every query to guarantee multi-tenant isolation

Interfaces

findByTenant(tenantId, options): UserPage
findById(tenantId, userId): User | null
findByEmail(tenantId, email): User | null
create(tenantId, userData): User
update(tenantId, userId, changes): User
deactivate(tenantId, userId): void
delete(tenantId, userId): void