mirror of
https://github.com/zadam/trilium.git
synced 2025-11-01 02:45:54 +01:00
cleanup of labels and relations from backend
This commit is contained in:
@@ -33,12 +33,6 @@ async function updateEntity(sync, entity, sourceId) {
|
||||
else if (entityName === 'attributes') {
|
||||
await updateAttribute(entity, sourceId);
|
||||
}
|
||||
else if (entityName === 'labels') {
|
||||
await updateLabel(entity, sourceId);
|
||||
}
|
||||
else if (entityName === 'relations') {
|
||||
await updateRelation(entity, sourceId);
|
||||
}
|
||||
else if (entityName === 'api_tokens') {
|
||||
await updateApiToken(entity, sourceId);
|
||||
}
|
||||
@@ -191,34 +185,6 @@ async function updateAttribute(entity, sourceId) {
|
||||
}
|
||||
}
|
||||
|
||||
async function updateLabel(entity, sourceId) {
|
||||
const origLabel = await sql.getRow("SELECT * FROM labels WHERE labelId = ?", [entity.labelId]);
|
||||
|
||||
if (!origLabel || origLabel.dateModified <= entity.dateModified) {
|
||||
await sql.transactional(async () => {
|
||||
await sql.replace("labels", entity);
|
||||
|
||||
await syncTableService.addLabelSync(entity.labelId, sourceId);
|
||||
});
|
||||
|
||||
log.info("Update/sync label " + entity.labelId);
|
||||
}
|
||||
}
|
||||
|
||||
async function updateRelation(entity, sourceId) {
|
||||
const origRelation = await sql.getRow("SELECT * FROM relations WHERE relationId = ?", [entity.relationId]);
|
||||
|
||||
if (!origRelation || origRelation.dateModified <= entity.dateModified) {
|
||||
await sql.transactional(async () => {
|
||||
await sql.replace("relations", entity);
|
||||
|
||||
await syncTableService.addRelationSync(entity.relationId, sourceId);
|
||||
});
|
||||
|
||||
log.info("Update/sync relation " + entity.relationId);
|
||||
}
|
||||
}
|
||||
|
||||
async function updateApiToken(entity, sourceId) {
|
||||
const apiTokenId = await sql.getRow("SELECT * FROM api_tokens WHERE apiTokenId = ?", [entity.apiTokenId]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user