User Model
The User model represents authenticated users in the system. It extends BaseModel and includes authentication capabilities through the AuthFinder mixin. Location:apps/web/app/users/models/user.ts
Properties
Primary key identifier for the user
Foreign key reference to the user’s role
User’s full name (optional)
User’s email address (unique, used for authentication)
Hashed password using scrypt algorithm (not serialized in API responses)
User avatar image with thumbnail variant support
Pre-computed URL for the avatar image
Timestamp when the user was created (auto-generated)
Timestamp when the user was last updated (auto-updated)
Relationships
role - BelongsTo
role - BelongsTo
resetPasswordTokens - HasMany
resetPasswordTokens - HasMany
Computed Properties
Returns true if the user has admin role privileges
Methods
preComputeUrls()
preComputeUrls()
Static method to pre-compute avatar URLs for one or multiple users.Parameters:
models- Single user or array of users to process
accessTokens
accessTokens
Static property for managing API access tokens.Methods:
create(user, abilities?, options?)- Create new access tokenall(user)- Get all tokens for a userdelete(user, tokenId)- Delete a specific token
Authentication
The User model uses thewithAuthFinder mixin with the following configuration:
- Hash Driver: scrypt
- Unique Identifier: email
- Password Column: password
Role Model
The Role model defines user roles and their associated permissions. Location:apps/web/app/users/models/role.ts
Properties
Primary key identifier for the role
Role name (e.g., “admin”, “user”)
Human-readable description of the role
Timestamp when the role was created
Timestamp when the role was last updated
Relationships
users - HasMany
users - HasMany
ResetPasswordToken Model
The ResetPasswordToken model stores temporary tokens for password reset flows. Location:apps/web/app/users/models/reset_password_token.ts
Properties
Primary key identifier for the token
Foreign key reference to the user
Unique token string for password reset
Timestamp when the token was created
Timestamp when the token expires
Relationships
user - BelongsTo
user - BelongsTo
BaseModel
Abstract base model that provides common timestamp fields for all models. Location:apps/web/app/common/models/base_model.ts
Properties
Timestamp when the record was created (auto-generated)
Timestamp when the record was last updated (auto-updated)
Usage
Extend BaseModel to automatically include timestamp tracking:Type Definitions
MailBasicTranslation
Interface for email translation content. Location:apps/web/app/common/models/mail_basic_translation.ts
Email subject line
Main heading in the email
Secondary heading or description
Text for the call-to-action button
Fallback message content