From 63092249e5a61845c86fe17884a8dc89d69dc295 Mon Sep 17 00:00:00 2001 From: benjamin Date: Fri, 6 Dec 2024 10:35:05 +0100 Subject: [PATCH] feat(eig): hide eigs --- packages/backend/src/app.js | 2 +- .../eig/delete.test_hide.js} | 0 .../eig/get-admin-by-ds-id.test_hide.js} | 0 .../eig/get-admin-by-id.test_hide.js} | 0 .../eig/get-admin.test_hide.js} | 0 .../eig/get-by-ds-id.test_hide.js} | 0 .../eig/get-by-id.test_hide.js} | 0 .../eig/get-me.test_hide.js} | 0 .../eig/post-depose.test_hide.js} | 0 .../eig/post-mark-as-read.test_hide.js} | 0 .../eig/post.test_hide.js} | 0 .../eig/put-update.test_hide.js} | 0 .../src/composables/useMenuNavItem.js | 16 ++++++------ .../src/middleware/redirect-eig.global.js | 13 ++++++++++ .../src/pages/sejours/[declarationId].vue | 4 +-- .../src/composables/useMenuNavItem.js | 26 +++++++++---------- .../src/middleware/redirect-eig.global.js | 13 ++++++++++ .../demande-sejour/[[declarationId]].vue | 18 ++++++------- 18 files changed, 59 insertions(+), 33 deletions(-) rename packages/backend/src/routes/{__tests__/eig/delete.test.js => __hidden_test_eig__/eig/delete.test_hide.js} (100%) rename packages/backend/src/routes/{__tests__/eig/get-admin-by-ds-id.test.js => __hidden_test_eig__/eig/get-admin-by-ds-id.test_hide.js} (100%) rename packages/backend/src/routes/{__tests__/eig/get-admin-by-id.test.js => __hidden_test_eig__/eig/get-admin-by-id.test_hide.js} (100%) rename packages/backend/src/routes/{__tests__/eig/get-admin.test.js => __hidden_test_eig__/eig/get-admin.test_hide.js} (100%) rename packages/backend/src/routes/{__tests__/eig/get-by-ds-id.test.ds.js => __hidden_test_eig__/eig/get-by-ds-id.test_hide.js} (100%) rename packages/backend/src/routes/{__tests__/eig/get-by-id.test.js => __hidden_test_eig__/eig/get-by-id.test_hide.js} (100%) rename packages/backend/src/routes/{__tests__/eig/get-me.test.js => __hidden_test_eig__/eig/get-me.test_hide.js} (100%) rename packages/backend/src/routes/{__tests__/eig/post-depose.test.js => __hidden_test_eig__/eig/post-depose.test_hide.js} (100%) rename packages/backend/src/routes/{__tests__/eig/post-mark-as-read.test.js => __hidden_test_eig__/eig/post-mark-as-read.test_hide.js} (100%) rename packages/backend/src/routes/{__tests__/eig/post.test.js => __hidden_test_eig__/eig/post.test_hide.js} (100%) rename packages/backend/src/routes/{__tests__/eig/put-update.js => __hidden_test_eig__/eig/put-update.test_hide.js} (100%) create mode 100644 packages/frontend-bo/src/middleware/redirect-eig.global.js create mode 100644 packages/frontend-usagers/src/middleware/redirect-eig.global.js diff --git a/packages/backend/src/app.js b/packages/backend/src/app.js index dbb4a059a..a9190a81a 100644 --- a/packages/backend/src/app.js +++ b/packages/backend/src/app.js @@ -90,7 +90,7 @@ app.use(`/hebergement`, routes.hebergement); app.use(`/siret`, routes.siret); app.use(`/documents`, routes.documents); app.use(`/geo`, routes.geo); -app.use(`/eig`, routes.eig); +//app.use(`/eig`, routes.eig); app.use(`/message`, routes.message); app.use(`/territoire`, routes.territoire); app.use(`/healthz`, routes.healthz); diff --git a/packages/backend/src/routes/__tests__/eig/delete.test.js b/packages/backend/src/routes/__hidden_test_eig__/eig/delete.test_hide.js similarity index 100% rename from packages/backend/src/routes/__tests__/eig/delete.test.js rename to packages/backend/src/routes/__hidden_test_eig__/eig/delete.test_hide.js diff --git a/packages/backend/src/routes/__tests__/eig/get-admin-by-ds-id.test.js b/packages/backend/src/routes/__hidden_test_eig__/eig/get-admin-by-ds-id.test_hide.js similarity index 100% rename from packages/backend/src/routes/__tests__/eig/get-admin-by-ds-id.test.js rename to packages/backend/src/routes/__hidden_test_eig__/eig/get-admin-by-ds-id.test_hide.js diff --git a/packages/backend/src/routes/__tests__/eig/get-admin-by-id.test.js b/packages/backend/src/routes/__hidden_test_eig__/eig/get-admin-by-id.test_hide.js similarity index 100% rename from packages/backend/src/routes/__tests__/eig/get-admin-by-id.test.js rename to packages/backend/src/routes/__hidden_test_eig__/eig/get-admin-by-id.test_hide.js diff --git a/packages/backend/src/routes/__tests__/eig/get-admin.test.js b/packages/backend/src/routes/__hidden_test_eig__/eig/get-admin.test_hide.js similarity index 100% rename from packages/backend/src/routes/__tests__/eig/get-admin.test.js rename to packages/backend/src/routes/__hidden_test_eig__/eig/get-admin.test_hide.js diff --git a/packages/backend/src/routes/__tests__/eig/get-by-ds-id.test.ds.js b/packages/backend/src/routes/__hidden_test_eig__/eig/get-by-ds-id.test_hide.js similarity index 100% rename from packages/backend/src/routes/__tests__/eig/get-by-ds-id.test.ds.js rename to packages/backend/src/routes/__hidden_test_eig__/eig/get-by-ds-id.test_hide.js diff --git a/packages/backend/src/routes/__tests__/eig/get-by-id.test.js b/packages/backend/src/routes/__hidden_test_eig__/eig/get-by-id.test_hide.js similarity index 100% rename from packages/backend/src/routes/__tests__/eig/get-by-id.test.js rename to packages/backend/src/routes/__hidden_test_eig__/eig/get-by-id.test_hide.js diff --git a/packages/backend/src/routes/__tests__/eig/get-me.test.js b/packages/backend/src/routes/__hidden_test_eig__/eig/get-me.test_hide.js similarity index 100% rename from packages/backend/src/routes/__tests__/eig/get-me.test.js rename to packages/backend/src/routes/__hidden_test_eig__/eig/get-me.test_hide.js diff --git a/packages/backend/src/routes/__tests__/eig/post-depose.test.js b/packages/backend/src/routes/__hidden_test_eig__/eig/post-depose.test_hide.js similarity index 100% rename from packages/backend/src/routes/__tests__/eig/post-depose.test.js rename to packages/backend/src/routes/__hidden_test_eig__/eig/post-depose.test_hide.js diff --git a/packages/backend/src/routes/__tests__/eig/post-mark-as-read.test.js b/packages/backend/src/routes/__hidden_test_eig__/eig/post-mark-as-read.test_hide.js similarity index 100% rename from packages/backend/src/routes/__tests__/eig/post-mark-as-read.test.js rename to packages/backend/src/routes/__hidden_test_eig__/eig/post-mark-as-read.test_hide.js diff --git a/packages/backend/src/routes/__tests__/eig/post.test.js b/packages/backend/src/routes/__hidden_test_eig__/eig/post.test_hide.js similarity index 100% rename from packages/backend/src/routes/__tests__/eig/post.test.js rename to packages/backend/src/routes/__hidden_test_eig__/eig/post.test_hide.js diff --git a/packages/backend/src/routes/__tests__/eig/put-update.js b/packages/backend/src/routes/__hidden_test_eig__/eig/put-update.test_hide.js similarity index 100% rename from packages/backend/src/routes/__tests__/eig/put-update.js rename to packages/backend/src/routes/__hidden_test_eig__/eig/put-update.test_hide.js diff --git a/packages/frontend-bo/src/composables/useMenuNavItem.js b/packages/frontend-bo/src/composables/useMenuNavItem.js index 6a2fa920c..49a2bab09 100644 --- a/packages/frontend-bo/src/composables/useMenuNavItem.js +++ b/packages/frontend-bo/src/composables/useMenuNavItem.js @@ -88,14 +88,14 @@ export const useMenuNavItems = () => { }, ] : []), - ...(roles.includes("eig") - ? [ - { - text: "EIG", - to: "/eig", - }, - ] - : []), + /* ...(roles.includes("eig") + ? [ + { + text: "EIG", + to: "/eig", + }, + ] + : []),*/ ]; }); diff --git a/packages/frontend-bo/src/middleware/redirect-eig.global.js b/packages/frontend-bo/src/middleware/redirect-eig.global.js new file mode 100644 index 000000000..7489523e0 --- /dev/null +++ b/packages/frontend-bo/src/middleware/redirect-eig.global.js @@ -0,0 +1,13 @@ +// TODO(eig): To remove when eig is ready + +import { logger } from "#imports"; +import { defineNuxtRouteMiddleware, navigateTo } from "#app"; + +const log = logger("middleware/check-role"); + +export default defineNuxtRouteMiddleware(async (to) => { + if (to.path.match("/eig")) { + return navigateTo("/connexion", { redirectCode: 301 }); + } + log.i("DONE"); +}); diff --git a/packages/frontend-bo/src/pages/sejours/[declarationId].vue b/packages/frontend-bo/src/pages/sejours/[declarationId].vue index 79fdc634a..4fe44809e 100644 --- a/packages/frontend-bo/src/pages/sejours/[declarationId].vue +++ b/packages/frontend-bo/src/pages/sejours/[declarationId].vue @@ -60,12 +60,12 @@ const tabs = [ tabId: "tabpanel-messagerie", href: "messagerie", }, - { + /*{ label: "EIG", tabPanelId: "tabpanel-eig-panel", tabId: "tabpanel-eig", href: "eig", - }, + },*/ ]; const defaultTab = tabs.findIndex(({ href }) => route.name.includes(href)); diff --git a/packages/frontend-usagers/src/composables/useMenuNavItem.js b/packages/frontend-usagers/src/composables/useMenuNavItem.js index 9c17dfd9b..e4c666b2e 100644 --- a/packages/frontend-usagers/src/composables/useMenuNavItem.js +++ b/packages/frontend-usagers/src/composables/useMenuNavItem.js @@ -47,19 +47,19 @@ export const useMenuNavItems = () => { text: "Mes hébergements", to: "/hebergements/liste", }, - { - title: "EIG", - links: [ - { - text: "Mes EIG", - to: "/eig/liste", - }, - { - text: "Créer un EIG", - to: "/eig", - }, - ], - }, + /* { + title: "EIG", + links: [ + { + text: "Mes EIG", + to: "/eig/liste", + }, + { + text: "Créer un EIG", + to: "/eig", + }, + ], + },*/ ]; }); }; diff --git a/packages/frontend-usagers/src/middleware/redirect-eig.global.js b/packages/frontend-usagers/src/middleware/redirect-eig.global.js new file mode 100644 index 000000000..7489523e0 --- /dev/null +++ b/packages/frontend-usagers/src/middleware/redirect-eig.global.js @@ -0,0 +1,13 @@ +// TODO(eig): To remove when eig is ready + +import { logger } from "#imports"; +import { defineNuxtRouteMiddleware, navigateTo } from "#app"; + +const log = logger("middleware/check-role"); + +export default defineNuxtRouteMiddleware(async (to) => { + if (to.path.match("/eig")) { + return navigateTo("/connexion", { redirectCode: 301 }); + } + log.i("DONE"); +}); diff --git a/packages/frontend-usagers/src/pages/demande-sejour/[[declarationId]].vue b/packages/frontend-usagers/src/pages/demande-sejour/[[declarationId]].vue index 8e89d8cc2..c8123259a 100644 --- a/packages/frontend-usagers/src/pages/demande-sejour/[[declarationId]].vue +++ b/packages/frontend-usagers/src/pages/demande-sejour/[[declarationId]].vue @@ -371,15 +371,15 @@ const tabTitles = computed(() => [ }, ] : []), - ...(sejourId.value - ? [ - { - title: "EIG", - tabId: "declaration-sejour-tab-4", - panelId: "declaration-sejour-content-4", - }, - ] - : []), + /* ...(sejourId.value + ? [ + { + title: "EIG", + tabId: "declaration-sejour-tab-4", + panelId: "declaration-sejour-content-4", + }, + ] + : []),*/ ]); const sommaireOptions = demandeSejourMenus