Turns the rows of users, once checked, into the User that
user-service.ts returns. A route turns a User into what it may send with
toPublicUser or toSelfUser.
Checks whether user's account lives on another instance, whose user signs
in here through federation (federation-service.ts). Their password,
email, avatar and name are that instance's to change, so the routes that
change them here refuse.
Checks whether obj, a row selected with the columns of UserRow, is
one.
Returns what anyone may see of user, without the hash and the email. Every
route that sends another user's profile goes through it.
Returns what user sees of themselves, without the hash, for the routes
that answer the caller's own account.
Converts a User back to a row, for updateUser. A User has no
inviter id, so invited_by comes out null: don't write it back.
Converts a row to a User, turning nulls into undefined.
Returned by the lookups of user-service.ts. It must never be sent as is:
it carries the password hash.
-
passwordHash: string | null
From
hashPassword, ashash.salt, or null for an account from another instance (isRemoteUser), which signs in there and never with a password here. The row stores that as''.
Selected by user-service.ts and follow-service.ts, and converted by
userRowToApi. It leaves out chat_read_at and tokens_valid_after,
which only the chat's read state and getSessionState query.
-
avatar_mime: string | null
Null without an avatar.
- created_at: string
-
description: string | null
Markdown.
- email: string
- id: string
-
invited_by: string | null
Null for the seeded admin, who had no inviter.
-
invited_by_username: string | null
Joined from the inviter's row rather than stored, and undefined when the query doesn't join it. The guard doesn't check it.
-
password_hash: string
''for an account from another instance, which has no password. - role: Role
-
updated_at: string | null
Bumped by any profile or avatar change.
- username: string
Usage
import * as mod from "api/model/user.ts";