added changeId into entity_changes to have cross-sync change ID

This commit is contained in:
zadam
2021-11-18 22:33:08 +01:00
parent 15ac81627c
commit e36bc42519
6 changed files with 34 additions and 10 deletions

View File

@@ -3,6 +3,7 @@ const sourceIdService = require('./source_id');
const dateUtils = require('./date_utils');
const log = require('./log');
const cls = require('./cls');
const utils = require('./utils');
const becca = require("../becca/becca");
let maxEntityChangeId = 0;
@@ -12,6 +13,10 @@ function addEntityChange(origEntityChange) {
delete ec.id;
if (!ec.changeId) {
ec.changeId = utils.randomString(12);
}
ec.sourceId = ec.sourceId || cls.getSourceId() || sourceIdService.getCurrentSourceId();
ec.isSynced = ec.isSynced ? 1 : 0;
ec.isErased = ec.isErased ? 1 : 0;