support for updating entities etc.

This commit is contained in:
azivner
2018-01-29 23:35:36 -05:00
parent 6fa6891496
commit 35c7b54176
6 changed files with 36 additions and 1 deletions

View File

@@ -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;