Skip to main content

User

Source: lyda-shared/src/Models/db/lyda/User.ts

Dependencies

import {Follow} from "./Follow.js";
import {UserBadge} from "./UserBadge.js";
import {Usersetting} from "./Usersetting.js";
import {Badge} from "./Badge.js";
import {Subscription} from "../finance/Subscription.js";
import {UserEmail} from "./UserEmail.js";
import {Permission} from "./Permission.js";
import {Entity} from "@targoninc/ts-search";
import {UserTotp} from "./UserTotp.ts";
import {PublicKey} from "./PublicKey.ts";

User

Represents a user entity with associated attributes and relationships.

The User interface extends the Entity interface from our search library and defines additional properties related to the user, including information about permissions, subscriptions, settings, badges, security credentials, and activity logs.

Type: interface

export interface User extends Entity {
permissions?: Permission[];
subscription?: Subscription;
settings?: Usersetting[];
badges?: Badge[];
userBadges?: UserBadge[];
follows?: Follow[];
following?: Follow[];
totp?: UserTotp[];
public_keys?: PublicKey[];
giftedSubscriptions?: Subscription[];
id: number;
username: string;
mfa_enabled: boolean;
emails: UserEmail[];
password_hash: string;
displayname: string;
description: string;
password_token: string|null;
verified: boolean;
verification_status: string;
created_at: Date;
updated_at: Date;
deleted_at: Date;
lastlogin?: Date;
secondlastlogin?: Date;
password_updated_at: Date;
tos_agreed_at: Date;
ip: string;
has_avatar: boolean;
has_banner: boolean;
email_mfa_code: string;
passkey_user_id: string;
}

Properties

PropertyTypeRequiredDescription
permissionsPermission[]No-
subscriptionSubscriptionNo-
settingsUsersetting[]No-
badgesBadge[]No-
userBadgesUserBadge[]No-
followsFollow[]No-
followingFollow[]No-
totpUserTotp[]No-
public_keysPublicKey[]No-
giftedSubscriptionsSubscription[]No-
idnumberYes-
usernamestringYes-
mfa_enabledbooleanYes-
emailsUserEmail[]Yes-
password_hashstringYes-
displaynamestringYes-
descriptionstringYes-
password_tokenstring or nullYes-
verifiedbooleanYes-
verification_statusstringYes-
created_atD​a​t​eYes-
updated_atD​a​t​eYes-
deleted_atD​a​t​eYes-
lastloginD​a​t​eNo-
secondlastloginD​a​t​eNo-
password_updated_atD​a​t​eYes-
tos_agreed_atD​a​t​eYes-
ipstringYes-
has_avatarbooleanYes-
has_bannerbooleanYes-
email_mfa_codestringYes-
passkey_user_idstringYes-