AdminUserRepository
Component Detail
Data Layer
medium complexity
backend
0
Dependencies
0
Dependents
3
Entities
0
Integrations
Description
Data access layer providing all CRUD and query operations against the users, pending_invitations, and org_audit_trail tables. Scopes every query to a tenant ID to enforce row-level isolation at the database layer. Handles soft-deletion semantics for GDPR data-subject erasure requests.
admin-user-repository
Sources & reasoning
Blueprint tags user-crud [MVP] and the Admin Web Portal MVP scope (lines 326, 329) explicitly lists brukeradministrasjon as a launch requirement and confirms Coordinators and Peer Mentors are managed records, not portal users. Target release is MVP per both the blueprint and the source doc's Admin Web Portal MVP section.
-
docs/source/likeperson.md · line 326Brukeradministrasjon (invitere, deaktivere, rolletildeling)
-
docs/source/likeperson.md · line 329Coordinators og Peer Mentors logger IKKE inn i admin-portalen; de forvaltes som datarecords (invitasjon, rolletildeling, deaktivering) av Org Admin.
Responsibilities
- Execute tenant-scoped queries for user listing, filtering, and pagination
- Persist new user records and pending invitation tokens with expiry timestamps
- Apply soft-delete and hard-delete paths for deactivation and GDPR erasure respectively
- Insert structured audit-trail rows for every write operation with actor, timestamp, and diff payload
- Provide lookup by email, userId, and invitation token for service-layer validation
Interfaces
findByTenant(tenantId, query: UserQuery): UserRecord[]
findById(userId): UserRecord | null
findByEmail(tenantId, email): UserRecord | null
create(data: NewUserData): UserRecord
update(userId, patch: UserPatch): UserRecord
softDelete(userId): void
hardDelete(userId): void
createInvitation(tenantId, email, role, token, expiresAt): PendingInvitation
appendAuditEntry(entry: AuditEntry): void
Related Data Entities (3)
Data entities managed by this component