Optional
avatarUser's avatar URL
Optional
clientClient ID (for Apollo Studio)
Date, when user was created.
Optional
deletedDate, when user was deleted.
Users's email. Must be unique.
'[email protected]'
User's first name
When user is invited to the system, it has one of the following statuses:
Optional
is2faRepresent Two-Factor Authentication status.
Optional
isRepresent One-Time Password status.
User's last name
Date, when user made last request to the system.
Optional
localeUser's locale in ISO 639-1 format.
Use LanguagesModule
to fetch lists with locales.
Optional
otpKeep One-Time Password secret.
Optional
parentParent user who was signed in as this user.
Optional
passwordUser's password hash. Generated from real password by bcrypt. When user logged in with password, password hash is compared with this field.
Optional
patronymicUser's patronymic name
User's custom permissions. In general, permissions must be inherited from roles. But you can add custom permissions to user.
Optional
phoneUser's phone number
Optional
referrerUser's referrer. It can be email or any other identifier.
'[email protected]'
User's resolved permissions.
This array is used by authorization guards to check user's permissions.
This array must be fullfilled by UserManager.resolve
when user tries to make request.
Users has two statuses: ACTIVE and DELETED.
ACTIVE - user is active and can signin to the system. DELETED - user is deleted and can't signin to the system.
Optional
timezoneUser's timezone name in IANA format.
Use TimezonesModule
to fetch lists with timezones.
Users has two types: USER and SA.
Date, when user was updated.
User's roles.
Static
targetReturns object that is managed by this repository. If this repository manages entity from schema, then it returns a name of that schema instead.
Checks if entity has an id. If entity composite compose ids, it will check them all.
Recovers a given entity in the database.
Optional
options: SaveOptionsReloads entity data from the database.
Removes current entity from the database.
Optional
options: RemoveOptionsSaves current entity in the database. If entity does not exist in the database then inserts, otherwise updates.
Optional
options: SaveOptionsRecords the delete date of current entity.
Optional
options: SaveOptionsStatic
averageStatic
clearClears all the data from the given table/collection (truncates/drops it).
Static
countStatic
countStatic
createStatic
createStatic
deleteDeletes entities by a given criteria. Unlike remove method executes a primitive operation without cascades, relations and other operations included. Executes fast and efficient DELETE query. Does not check if entity exist in the database.
Static
existsStatic
existsStatic
findStatic
findFinds entities that match given find options. Also counts all entities that match given conditions, but ignores pagination settings (from and take options).
Static
findStatic
findStatic
findStatic
findStatic
findStatic
findStatic
findStatic
findStatic
getStatic
getStatic
hasChecks entity has an id. If entity composite compose ids, it will check them all.
Static
insertInserts a given entity into the database. Unlike save method executes a primitive operation without cascades, relations and other operations included. Executes fast and efficient INSERT query. Does not check if entity exist in the database, so query will fail if duplicate entity is being inserted.
Static
maximumStatic
mergeStatic
minimumStatic
preloadCreates a new entity from the given plain javascript object. If entity already exist in the database, then it loads it (and everything related to it), replaces all values with the new ones from the given object and returns this new entity. This new entity is actually a loaded from the db entity with all properties replaced from the new object.
Note that given entity-like object must have an entity id / primary key to find entity by. Returns undefined if entity with given id was not found.
Static
queryExecutes a raw SQL query and returns a raw database results. Raw query execution is supported only by relational databases (MongoDB is not supported).
Optional
parameters: any[]Static
removeStatic
saveStatic
softStatic
sumStatic
updateUpdates entity partially. Entity can be found by a given conditions. Unlike save method executes a primitive operation without cascades, relations and other operations included. Executes fast and efficient UPDATE query. Does not check if entity exist in the database.
Static
upsertInserts a given entity into the database, unless a unique constraint conflicts then updates the entity Unlike save method executes a primitive operation without cascades, relations and other operations included. Executes fast and efficient INSERT ... ON CONFLICT DO UPDATE/ON DUPLICATE KEY UPDATE query.
Static
useSets DataSource to be used by entity.
The User Entity is a data schema that represents a user within your application. It typically includes fields such as the user's name, email address, password, and other profile information.