mirror of
https://github.com/zadam/trilium.git
synced 2025-11-01 10:55:55 +01:00
basic entities for attributes (unification of labels and relations)
This commit is contained in:
@@ -30,6 +30,9 @@ async function updateEntity(sync, entity, sourceId) {
|
||||
else if (entityName === 'note_images') {
|
||||
await updateNoteImage(entity, sourceId);
|
||||
}
|
||||
else if (entityName === 'attributes') {
|
||||
await updateAttribute(entity, sourceId);
|
||||
}
|
||||
else if (entityName === 'labels') {
|
||||
await updateLabel(entity, sourceId);
|
||||
}
|
||||
@@ -174,6 +177,20 @@ async function updateNoteImage(entity, sourceId) {
|
||||
}
|
||||
}
|
||||
|
||||
async function updateAttribute(entity, sourceId) {
|
||||
const origAttribute = await sql.getRow("SELECT * FROM attributes WHERE attributeId = ?", [entity.attributeId]);
|
||||
|
||||
if (!origAttribute || origAttribute.dateModified <= entity.dateModified) {
|
||||
await sql.transactional(async () => {
|
||||
await sql.replace("attributes", entity);
|
||||
|
||||
await syncTableService.addAttributeSync(entity.attributeId, sourceId);
|
||||
});
|
||||
|
||||
log.info("Update/sync attribute " + entity.attributeId);
|
||||
}
|
||||
}
|
||||
|
||||
async function updateLabel(entity, sourceId) {
|
||||
const origLabel = await sql.getRow("SELECT * FROM labels WHERE labelId = ?", [entity.labelId]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user