fix in passing originEntity from frontend to backend, some refactorings

This commit is contained in:
azivner
2018-08-16 23:00:04 +02:00
parent 385d97a9b3
commit 208771216e
14 changed files with 36 additions and 24 deletions

View File

@@ -15,9 +15,9 @@ async function getEntityFromName(entityName, entityId) {
return null;
}
const constructor = entityConstructor.getEntityFromTableName(entityName);
const constructor = entityConstructor.getEntityFromEntityName(entityName);
return await getEntity(`SELECT * FROM ${constructor.tableName} WHERE ${constructor.primaryKeyName} = ?`, [entityId]);
return await getEntity(`SELECT * FROM ${constructor.entityName} WHERE ${constructor.primaryKeyName} = ?`, [entityId]);
}
async function getEntities(query, params = []) {
@@ -57,7 +57,7 @@ async function getOption(name) {
}
async function updateEntity(entity) {
const entityName = entity.constructor.tableName;
const entityName = entity.constructor.entityName;
const primaryKeyName = entity.constructor.primaryKeyName;
const isNewEntity = !entity[primaryKeyName];