🗀 USERS
C_USERS extends COMMON_COMPONENT
Component to manage/update users, which should represent your phiscal building.
- Schema
- Methods
- Hooks
- Events
- Classes
- class.user.js Represents a user instance
| Name | Type | Required | Default value | Description |
|---|---|---|---|---|
| _id | String | ObjectId | MongoDB ObjectID converted to a String | |
| name | String | x | Username | |
| String | x | User E-Mail adress | ||
| password | String | x | Password in plaintext, which gets bcryted | |
| timestamps | Object | Timestamps, when something was done to the object e.g. created/updated |
||
| timestamps.created | Number | Date.now() |
Unix timestamp, set when .add is called to Date.now() |
|
| timestamps.updated | Number | null |
Unix timestamp, set to Date.now() when .update is called |
|
| enabled | Boolean | true |
Indicates if user accounts can be used to login/is enabled for use |
{
"_id":"611033f0acc919461c3a1962",
"name":"Name Surname",
"email":"[email protected]",
"password":"$2b$12$0E0RXurg73rd2/OJRDWepOlGKtgnbiv38NAwOnIarQkYku0v8cnFS",
"timestamps":{
"created":1628451824939,
"updated":null
},
"enabled": true
}data{Object} Object structure as defined in schema.cb{Function} Callback function, if absent, a promise is returned.
Add a new User to the database and creates a User instance
id{String} User id as defined in schema.cb{Function} Callback function, if absent, a promise is returned.
Get a User from the
.itemsarray
id{String} User id as defined in schema.cb{Function} Callback function, if absent, a promise is returned.
Removes a User from the database
id{String} User id as defined in schema.data{Object} Properties to update on Useridobject/instance.cb{Function} Callback function, if absent, a promise is returned.
Updates a User object in database & User instance in
.itemsarray
obj{Object} Key/value to look for Users.cb{Function} Callback function, if absent, a promise is returned.
Find User with mathing key/values pair in the
.itemsarray