From 121c2cc9a4d592f2c643d76cc85febf1203beef1 Mon Sep 17 00:00:00 2001 From: Eric Plaquevent Date: Mon, 10 Jan 2022 11:18:05 +0100 Subject: [PATCH 1/3] chore: rm siret-uai proxy route --- server/.env.example | 1 - server/src/http/routes/etablissement.js | 8 -------- 2 files changed, 9 deletions(-) diff --git a/server/.env.example b/server/.env.example index 433ad42a..d963e85d 100644 --- a/server/.env.example +++ b/server/.env.example @@ -2,7 +2,6 @@ TABLES_CORRESPONDANCE_ACCESS_KEY_ID= TABLES_CORRESPONDANCE_SECRET_ACCESS_KEY= TABLES_CORRESPONDANCE_ONISEP_FILE= -TABLES_CORRESPONDANCE_RNCP_XML_FILE= TABLES_CORRESPONDANCE_CONVENTION_FILES_PATH= TABLES_CORRESPONDANCES_API_ENTREPRISE_KEY= TABLES_CORRESPONDANCE_ONISEP_EMAIL= diff --git a/server/src/http/routes/etablissement.js b/server/src/http/routes/etablissement.js index 7203428d..91a4dcb9 100644 --- a/server/src/http/routes/etablissement.js +++ b/server/src/http/routes/etablissement.js @@ -55,13 +55,5 @@ module.exports = () => { }) ); - router.get( - "/etablissements/siret-uai", - tryCatch(async (req, res) => { - const { data } = await axios.get(`${CATALOGUE_API_URL}/entity/etablissements/siret-uai`, { params: req.query }); - return res.json(data); - }) - ); - return router; }; From 4557f0f3ba2b91855feea06c3a628c8a54fbcb44 Mon Sep 17 00:00:00 2001 From: Eric Plaquevent Date: Wed, 12 Jan 2022 15:58:56 +0100 Subject: [PATCH 2/3] chore: rm unnecessary history --- .../src/logic/services/etablissementService.js | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/server/src/logic/services/etablissementService.js b/server/src/logic/services/etablissementService.js index 20304fa5..781cfd40 100644 --- a/server/src/logic/services/etablissementService.js +++ b/server/src/logic/services/etablissementService.js @@ -7,17 +7,6 @@ const { diffEtablissement } = require("../../common/utils/diffUtils"); const apiCfaDock = require("../../common/apis/apiCfaDock"); -/* - * Build updates history - */ -const buildUpdatesHistory = (etablissement, updates, keys) => { - const from = keys.reduce((acc, key) => { - acc[key] = etablissement[key]; - return acc; - }, {}); - return [...(etablissement.updates_history ?? []), { from, to: { ...updates }, updated_at: Date.now() }]; -}; - const parseErrors = (messages) => { if (!messages) { return ""; @@ -29,7 +18,7 @@ const parseErrors = (messages) => { const etablissementService = async ( etablissement, - { withHistoryUpdate = true, scope = { siret: true, geoloc: true, conventionnement: true, onisep: true } } = {} + { scope = { siret: true, geoloc: true, conventionnement: true, onisep: true } } = {} ) => { try { let error = null; @@ -176,11 +165,8 @@ const etablissementService = async ( const published = !updatedEtablissement.ferme && updatedEtablissement.api_entreprise_reference; updatedEtablissement.published = published; - const { updates, keys } = diffEtablissement(etablissement, updatedEtablissement); + const { updates } = diffEtablissement(etablissement, updatedEtablissement); if (updates) { - if (withHistoryUpdate) { - updatedEtablissement.updates_history = buildUpdatesHistory(etablissement, updates, keys); - } return { updates, etablissement: updatedEtablissement }; } } From e71e2b69b18a928b860fbe6147481ae8adbff298 Mon Sep 17 00:00:00 2001 From: Eric Plaquevent Date: Wed, 12 Jan 2022 16:22:40 +0100 Subject: [PATCH 3/3] fix: force sdk publish --- server/src/logic/services/etablissementService.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/server/src/logic/services/etablissementService.js b/server/src/logic/services/etablissementService.js index 781cfd40..aac80fb5 100644 --- a/server/src/logic/services/etablissementService.js +++ b/server/src/logic/services/etablissementService.js @@ -162,8 +162,7 @@ const etablissementService = async ( ...updatedEtablissement, }; - const published = !updatedEtablissement.ferme && updatedEtablissement.api_entreprise_reference; - updatedEtablissement.published = published; + updatedEtablissement.published = !updatedEtablissement.ferme && updatedEtablissement.api_entreprise_reference; const { updates } = diffEtablissement(etablissement, updatedEtablissement); if (updates) {