Module: database/repositories/userRepo

User CRUD backed by SQLite.

Source:

Methods

(static) create(user)

Create a user.

Parameters:
Name Type Description
user Object

— { id, name, email, passwordHash, role, avatar, createdAt, updatedAt, emailVerified }

Source:

(static) getAll() → {Array.<Object>}

Get all users.

Source:
Returns:
Type
Array.<Object>

(static) getByEmail(email) → {Object|undefined}

Find a user by email (case-sensitive — callers should lowercase before storing).

Parameters:
Name Type Description
email string
Source:
Returns:
Type
Object | undefined

(static) getById(id) → {Object|undefined}

Get a user by ID.

Parameters:
Name Type Description
id string
Source:
Returns:
Type
Object | undefined

(static) getOAuthUserId(key) → {string|undefined}

Get the userId linked to an OAuth key (e.g. "github:12345").

Parameters:
Name Type Description
key string
Source:
Returns:
Type
string | undefined

Link an OAuth key to a userId.

Parameters:
Name Type Description
key string
userId string
Source:

(static) update(id, fields)

Update specific fields on a user.

Parameters:
Name Type Description
id string
fields Object

— Partial user fields to update.

Source: