Constructor
#
new BaseModel(options)
Constructor for the base model.
Parameters:
Name |
Type |
Description |
options |
object
|
Properties
|
Members
#
createdAt :Date
The date that the model was created.
Handled by the server and does not need to be set by the client.
Practical Examples
Sort messages in ascending order by their createdAt date:
messages.sort((a, b) => a.createdAt - b.createdAt);
#
id :string
The id of the model.
Unique across all models of the same type.
For example, the id of a Message is unique across all messages.
The id of an Identity is unique across all identities.
However the id of a Message may coincidentally be the
same as the id of an Identity.
#
updatedAt :Date
The date that the model was last updated.
Handled by the server and does not need to be set by the client.
Practical Examples
Sort messages in ascending order by when they were last edited:
messages.sort((a, b) => a.createdAt - b.createdAt);
Methods
#
toJSON() → {Object}
Convert this entity to a JSON object that could be fed to its constructor to create another object with the same data