mirror of
https://github.com/zadam/trilium.git
synced 2025-11-01 19:05:59 +01:00
simplified new entity ID allocation
This commit is contained in:
@@ -12,6 +12,12 @@ class Entity {
|
||||
}
|
||||
}
|
||||
|
||||
beforeSaving() {
|
||||
if (!this[this.constructor.primaryKeyName]) {
|
||||
this[this.constructor.primaryKeyName] = utils.newEntityId();
|
||||
}
|
||||
}
|
||||
|
||||
async save() {
|
||||
await repository.updateEntity(this);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user