mirror of
https://github.com/zadam/trilium.git
synced 2025-11-17 10:40:41 +01:00
fix in passing originEntity from frontend to backend, some refactorings
This commit is contained in:
@@ -17,7 +17,7 @@ const Option = require('../entities/option');
|
||||
|
||||
async function getHash(entityConstructor, whereBranch) {
|
||||
// subselect is necessary to have correct ordering in GROUP_CONCAT
|
||||
const query = `SELECT GROUP_CONCAT(hash) FROM (SELECT hash FROM ${entityConstructor.tableName} `
|
||||
const query = `SELECT GROUP_CONCAT(hash) FROM (SELECT hash FROM ${entityConstructor.entityName} `
|
||||
+ (whereBranch ? `WHERE ${whereBranch} ` : '') + `ORDER BY ${entityConstructor.primaryKeyName})`;
|
||||
|
||||
let contentToHash = await sql.getValue(query);
|
||||
|
||||
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user