IdentityModule · library/auth/src/repos/users.ts:34

UsersRepo

component

No JSDoc comment in source yet.

API

@Component()
export class UsersRepo implements Users {
  @Use() private readonly db!: Db;
  insert(row: UserRow): void;
  findById(userId: string): UserRow | null;
  list(): UserRow[];
  count(): number;
  updatePassword(userId: string, passwordHash: string, isInitial: boolean): void;
  updateProfile(userId: string, patch: { displayName?: string | null; avatar?: string | null }): void;
  delete(userId: string): void;
}

Dependencies & Wiring

Extracted from class decorators
implementsinterfaces
@Userequires (1)
db: Db

Methods (7)

insert

insert(row: UserRow): void
@paramrowUserRow
@returnsvoid

findById

findById(userId: string): UserRow | null
@paramuserIdstring
@returnsUserRow | null

list

list(): UserRow[]

All users (for the admin user backend), ordered by creation time ascending.

@returnsUserRow[]

count

count(): number
@returnsnumber

updatePassword

updatePassword(userId: string, passwordHash: string, isInitial: boolean): void

Update the password hash; isInitial marks whether the password was set by someone else (seed / admin).

@paramuserIdstring
@parampasswordHashstring
@paramisInitialboolean
@returnsvoid

updateProfile

updateProfile(userId: string, patch: { displayName?: string | null; avatar?: string | null }): void

Writes the profile fields the patch names, leaving the rest as they are: an absent key keeps the stored value, null clears it, a string replaces it. A patch naming neither field writes nothing rather than issuing an UPDATE with an empty SET list.

@paramuserIdstring
@parampatch{ displayName?: string | null; avatar?: string | null }
@returnsvoid

delete

delete(userId: string): void

Used by admin user deletion and account-creation compensation paths (owned Projects must be cleaned up first).

@paramuserIdstring
@returnsvoid