mirror of
https://github.com/zadam/trilium.git
synced 2025-11-11 07:45:51 +01:00
support for updating entities etc.
This commit is contained in:
@@ -57,6 +57,20 @@ class Repository {
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
async updateEntity(entity) {
|
||||
if (entity.beforeSaving) {
|
||||
entity.beforeSaving();
|
||||
}
|
||||
|
||||
const clone = {...entity};
|
||||
|
||||
delete clone.dataKey;
|
||||
delete clone.jsonContent;
|
||||
delete clone.repository;
|
||||
|
||||
await sql.replace(entity.constructor.tableName, entity);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Repository;
|
||||
Reference in New Issue
Block a user