Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • web-et-numerique/factory/llle_project/enedis-sge-konnector
1 result
Show changes
Commits on Source (5)
...@@ -2,6 +2,14 @@ ...@@ -2,6 +2,14 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
### [1.1.4](https://forge.grandlyon.com/web-et-numerique/llle_project/enedis-sge-konnector/compare/v1.1.3...v1.1.4) (2022-10-28)
### Bug Fixes
* **account:** account storing ID ([14c54fe](https://forge.grandlyon.com/web-et-numerique/llle_project/enedis-sge-konnector/commit/14c54fef1d41523d9df5356e374f098a622d5973))
* **account:** saving account data issue ([a214214](https://forge.grandlyon.com/web-et-numerique/llle_project/enedis-sge-konnector/commit/a214214a91cddfe53db14c65d3de839c54922fed))
### [1.1.3](https://forge.grandlyon.com/web-et-numerique/llle_project/enedis-sge-konnector/compare/v1.1.2...v1.1.3) (2022-10-25) ### [1.1.3](https://forge.grandlyon.com/web-et-numerique/llle_project/enedis-sge-konnector/compare/v1.1.2...v1.1.3) (2022-10-25)
### [1.1.2](https://forge.grandlyon.com/web-et-numerique/llle_project/enedis-sge-konnector/compare/v1.1.1...v1.1.2) (2022-10-21) ### [1.1.2](https://forge.grandlyon.com/web-et-numerique/llle_project/enedis-sge-konnector/compare/v1.1.1...v1.1.2) (2022-10-21)
......
{ {
"version": "1.1.3", "version": "1.1.4",
"name": "Enedis SGE", "name": "Enedis SGE",
"type": "konnector", "type": "konnector",
"language": "node", "language": "node",
......
{ {
"name": "enedissgegrandlyon", "name": "enedissgegrandlyon",
"version": "1.1.3", "version": "1.1.4",
"description": "", "description": "",
"repository": { "repository": {
"type": "https", "type": "https",
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
"keywords": [], "keywords": [],
"author": "Cozy Cloud", "author": "Cozy Cloud",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"main": "./src/index.js",
"eslintConfig": { "eslintConfig": {
"extends": [ "extends": [
"cozy-app" "cozy-app"
......
...@@ -168,7 +168,7 @@ async function start(fields, cozyParameters) { ...@@ -168,7 +168,7 @@ async function start(fields, cozyParameters) {
// Save bo id into account // Save bo id into account
const accountData = await getAccount(ACCOUNT_ID) const accountData = await getAccount(ACCOUNT_ID)
await saveAccountData(this.accountId, { await saveAccountData(ACCOUNT_ID, {
...accountData.data, ...accountData.data,
consentId: consent.ID, consentId: consent.ID,
expirationDate: contractEndDate, expirationDate: contractEndDate,
......
...@@ -6,11 +6,28 @@ async function saveAccountData(accountId, accountData) { ...@@ -6,11 +6,28 @@ async function saveAccountData(accountId, accountData) {
log('info', `saveAccountData: ${accountId}`) log('info', `saveAccountData: ${accountId}`)
let account = await getAccount(accountId) let account = await getAccount(accountId)
log('info', `saveAccountData account: ${JSON.stringify(account)}`)
log(
'info',
`saveAccountData account: ${JSON.stringify({
...account,
data: accountData,
})}`
)
log(
'info',
`saveAccountData account after id: ${JSON.stringify({
...account,
data: accountData,
})}`
)
account = await updateOrCreate( account = await updateOrCreate(
[{ ...account, data: accountData }], [{ ...account, data: accountData }],
'io.cozy.accounts' 'io.cozy.accounts',
['account_type']
) )
log('info', `saveAccountData account reply: ${JSON.stringify(account)}`)
return account return account
} }
...@@ -22,6 +39,7 @@ async function saveAccountData(accountId, accountData) { ...@@ -22,6 +39,7 @@ async function saveAccountData(accountId, accountData) {
async function getAccount(accountId) { async function getAccount(accountId) {
log('info', `getAccount: ${accountId}`) log('info', `getAccount: ${accountId}`)
const accounts = await cozyClient.data.findAll('io.cozy.accounts') const accounts = await cozyClient.data.findAll('io.cozy.accounts')
log('info', `getAccount data: ${JSON.stringify(accounts)}`)
return accounts.filter(account => return accounts.filter(account =>
isLocal() ? account._id === accountId : account.account_type === accountId isLocal() ? account._id === accountId : account.account_type === accountId
)[0] )[0]
......