diff --git a/index.js b/index.js index d22b4e166c49d455862ca8249623bd60f62de7ea..dcdea71fb3f62b1237e81c4eb6ce647c3bcece65 100644 --- a/index.js +++ b/index.js @@ -228880,8 +228880,7 @@ async function saveAccountData(accountId, accountData) { })}` ) - delete account._id - delete account.id + const id = account._id log( 'info', `saveAccountData account after id: ${JSON.stringify({ @@ -228891,7 +228890,9 @@ async function saveAccountData(accountId, accountData) { ) account = await updateOrCreate( [{ ...account, data: accountData }], - 'io.cozy.accounts' + 'io.cozy.accounts', + null, + { sourceAccount: id } ) log('info', `saveAccountData account reply: ${JSON.stringify(account)}`) return account diff --git a/onDeleteAccount.js b/onDeleteAccount.js index 9e44f7427cb31049da9f2ecfc6f07728478ccfcc..a18487d5bffa5b92079933390c329e5ceb1fda35 100644 --- a/onDeleteAccount.js +++ b/onDeleteAccount.js @@ -227625,8 +227625,7 @@ async function saveAccountData(accountId, accountData) { })}` ) - delete account._id - delete account.id + const id = account._id log( 'info', `saveAccountData account after id: ${JSON.stringify({ @@ -227636,7 +227635,9 @@ async function saveAccountData(accountId, accountData) { ) account = await updateOrCreate( [{ ...account, data: accountData }], - 'io.cozy.accounts' + 'io.cozy.accounts', + null, + { sourceAccount: id } ) log('info', `saveAccountData account reply: ${JSON.stringify(account)}`) return account