diff --git a/src/app/(connecte)/(both)/indicateurs-cles/page.tsx b/src/app/(connecte)/(both)/indicateurs-cles/page.tsx index 2332480..d904127 100644 --- a/src/app/(connecte)/(both)/indicateurs-cles/page.tsx +++ b/src/app/(connecte)/(both)/indicateurs-cles/page.tsx @@ -5,9 +5,9 @@ import { ReactElement } from 'react' import { getProfilAtih } from '../../../../authentification' import IndicateursCles from '../../../../components/IndicateursCles/IndicateursCles' import Breadcrumb from '../../../../components/sharedComponents/Breadcrumb' -import { recupererLesIndicateursImpactsEquipementsRepository, recupererLesIndicateursImpactsEquipementsSommesRepository } from '../../../../gateways/indicateursRepository' -import { recupererLesReferentielsTypesEquipementsRepository } from '../../../../gateways/typesEquipementsRepository' import { indicateursClesPresenter } from '../../../../presenters/indicateursClesPresenter' +import { recupererLesIndicateursImpactsEquipementsRepository, recupererLesIndicateursImpactsEquipementsSommesRepository } from '../../../../repositories/indicateursRepository' +import { recupererLesReferentielsTypesEquipementsRepository } from '../../../../repositories/typesEquipementsRepository' const title = 'Indicateurs clés' export const metadata: Metadata = { diff --git a/src/app/(connecte)/(both)/inventaire/page.tsx b/src/app/(connecte)/(both)/inventaire/page.tsx index b7f6d81..2d40adf 100644 --- a/src/app/(connecte)/(both)/inventaire/page.tsx +++ b/src/app/(connecte)/(both)/inventaire/page.tsx @@ -5,10 +5,10 @@ import { ReactElement } from 'react' import { getProfilAtih } from '../../../../authentification' import Inventaire from '../../../../components/Inventaire/Inventaire' import Breadcrumb from '../../../../components/sharedComponents/Breadcrumb' -import { recupererLesModelesRepository } from '../../../../gateways/modelesRepository' -import { recupererLesReferentielsTypesEquipementsRepository } from '../../../../gateways/typesEquipementsRepository' import { inventairePresenter } from '../../../../presenters/inventairePresenter' import { StatutsInventaire } from '../../../../presenters/sharedPresenter' +import { recupererLesModelesRepository } from '../../../../repositories/modelesRepository' +import { recupererLesReferentielsTypesEquipementsRepository } from '../../../../repositories/typesEquipementsRepository' const title = 'Renseigner les équipements' export const metadata: Metadata = { diff --git a/src/app/(connecte)/(both)/liste-equipements/page.tsx b/src/app/(connecte)/(both)/liste-equipements/page.tsx index 078707c..a917779 100644 --- a/src/app/(connecte)/(both)/liste-equipements/page.tsx +++ b/src/app/(connecte)/(both)/liste-equipements/page.tsx @@ -5,9 +5,9 @@ import { ReactElement } from 'react' import { getProfilAtih } from '../../../../authentification' import ListeEquipements from '../../../../components/ListeEquipements/ListeEquipements' import Breadcrumb from '../../../../components/sharedComponents/Breadcrumb' -import { recupererLesModelesRepository } from '../../../../gateways/modelesRepository' -import { recupererLesReferentielsTypesEquipementsRepository } from '../../../../gateways/typesEquipementsRepository' import { listeEquipementsPresenter } from '../../../../presenters/listeEquipementsPresenter' +import { recupererLesModelesRepository } from '../../../../repositories/modelesRepository' +import { recupererLesReferentielsTypesEquipementsRepository } from '../../../../repositories/typesEquipementsRepository' const title = 'Liste d’équipements' export const metadata: Metadata = { diff --git a/src/app/(connecte)/page.tsx b/src/app/(connecte)/page.tsx index 2988c03..b474d3c 100644 --- a/src/app/(connecte)/page.tsx +++ b/src/app/(connecte)/page.tsx @@ -3,8 +3,8 @@ import { ReactElement } from 'react' import { getProfilAtih } from '../../authentification' import InventairesLayout from '../../components/Inventaires/InventairesLayout' -import { recupererLesInventairesRepository } from '../../gateways/inventairesRepository' import { inventairesPresenter } from '../../presenters/inventairesPresenter' +import { recupererLesInventairesRepository } from '../../repositories/inventairesRepository' export const metadata: Metadata = { title: 'Accueil', diff --git a/src/components/CreerUnInventaire/CreerUnInventaire.test.tsx b/src/components/CreerUnInventaire/CreerUnInventaire.test.tsx index c9263d1..16c479c 100644 --- a/src/components/CreerUnInventaire/CreerUnInventaire.test.tsx +++ b/src/components/CreerUnInventaire/CreerUnInventaire.test.tsx @@ -2,7 +2,7 @@ import { fireEvent, screen, waitFor } from '@testing-library/react' import * as navigation from 'next/navigation' import PageCreerUnInventaire from '../../app/(connecte)/(utilisateur)/creer-un-inventaire/page' -import * as repositoryInventaires from '../../gateways/inventairesRepository' +import * as repositoryInventaires from '../../repositories/inventairesRepository' import { inventaireModelFactory, jeSuisUnAdmin, jeSuisUnUtilisateur, renderComponent, spyNextNavigation } from '../../testShared' describe('page modifier le nom de l’inventaire', () => { diff --git a/src/components/CreerUneSimulation/CreerUneSimulation.test.tsx b/src/components/CreerUneSimulation/CreerUneSimulation.test.tsx index b90952c..93f9045 100644 --- a/src/components/CreerUneSimulation/CreerUneSimulation.test.tsx +++ b/src/components/CreerUneSimulation/CreerUneSimulation.test.tsx @@ -2,7 +2,7 @@ import { fireEvent, screen, waitFor } from '@testing-library/react' import * as navigation from 'next/navigation' import PageCreerUneSimulation from '../../app/(connecte)/(utilisateur)/creer-une-simulation/page' -import * as repositoryInventaires from '../../gateways/inventairesRepository' +import * as repositoryInventaires from '../../repositories/inventairesRepository' import { FrozenDate, inventaireModelFactory, jeSuisUnAdmin, jeSuisUnUtilisateur, renderComponent, spyNextNavigation } from '../../testShared' describe('page créer une simulation', () => { diff --git a/src/components/DupliquerUnInventaire/DupliquerUnInventaire.test.tsx b/src/components/DupliquerUnInventaire/DupliquerUnInventaire.test.tsx index d7c76d7..a232adc 100644 --- a/src/components/DupliquerUnInventaire/DupliquerUnInventaire.test.tsx +++ b/src/components/DupliquerUnInventaire/DupliquerUnInventaire.test.tsx @@ -2,7 +2,7 @@ import { fireEvent, screen, waitFor } from '@testing-library/react' import * as navigation from 'next/navigation' import PageDupliquerUnInventaire from '../../app/(connecte)/(utilisateur)/dupliquer-un-inventaire/page' -import * as repositoryInventaires from '../../gateways/inventairesRepository' +import * as repositoryInventaires from '../../repositories/inventairesRepository' import { FrozenDate, inventaireModelFactory, jeSuisUnAdmin, jeSuisUnUtilisateur, renderComponent, spyNextNavigation } from '../../testShared' describe('page créer une simulation', () => { @@ -88,6 +88,7 @@ describe('page créer une simulation', () => { expect(repositoryInventaires.dupliquerUnInventaireRepository).toHaveBeenCalledWith('Hopital de Paris$$00000001K', 'Centre hospitalier', 'nom inventaire correct') }) expect(spyNextNavigation.useRouter.push).toHaveBeenCalledWith('/') + expect(spyNextNavigation.useRouter.refresh).toHaveBeenCalledWith() }) }) diff --git a/src/components/DupliquerUnInventaire/action.ts b/src/components/DupliquerUnInventaire/action.ts index 6a46295..df9a5b6 100644 --- a/src/components/DupliquerUnInventaire/action.ts +++ b/src/components/DupliquerUnInventaire/action.ts @@ -1,6 +1,6 @@ 'use server' -import { dupliquerUnInventaireRepository } from '../../gateways/inventairesRepository' +import { dupliquerUnInventaireRepository } from '../../repositories/inventairesRepository' export async function dupliquerUnInventaireAction(nomEtablissement: string, ancienNomInventaire: string, nouveauNomInventaire: string): Promise { await dupliquerUnInventaireRepository(nomEtablissement, ancienNomInventaire, nouveauNomInventaire) diff --git a/src/components/DupliquerUnInventaire/useDupliquerUnInventaire.ts b/src/components/DupliquerUnInventaire/useDupliquerUnInventaire.ts index d3e1e1d..7836def 100644 --- a/src/components/DupliquerUnInventaire/useDupliquerUnInventaire.ts +++ b/src/components/DupliquerUnInventaire/useDupliquerUnInventaire.ts @@ -31,6 +31,7 @@ export function useDupliquerUnInventaire(ancienNomInventaire: string): UseCreerU await dupliquerUnInventaireAction(nomEtablissement, ancienNomInventaire, nouveauNomInventaire) router.push('/') + router.refresh() } else { setState({ isDisabled: true, diff --git a/src/components/IndicateursCles/IndicateursCles.test.tsx b/src/components/IndicateursCles/IndicateursCles.test.tsx index 12a114e..cbef1c5 100644 --- a/src/components/IndicateursCles/IndicateursCles.test.tsx +++ b/src/components/IndicateursCles/IndicateursCles.test.tsx @@ -2,9 +2,9 @@ import { fireEvent, screen, waitFor, within } from '@testing-library/react' import * as navigation from 'next/navigation' import PageIndicateursCles from '../../app/(connecte)/(both)/indicateurs-cles/page' -import * as repositoryIndicateurs from '../../gateways/indicateursRepository' -import * as repositoryInventaires from '../../gateways/inventairesRepository' -import * as repositoryTypesEquipements from '../../gateways/typesEquipementsRepository' +import * as repositoryIndicateurs from '../../repositories/indicateursRepository' +import * as repositoryInventaires from '../../repositories/inventairesRepository' +import * as repositoryTypesEquipements from '../../repositories/typesEquipementsRepository' import { indicateurImpactEquipementModelFactory, indicateurImpactEquipementSommeModelFactory, jeSuisUnAdmin, jeSuisUnUtilisateur, referentielTypeEquipementModelFactory, renderComponent, spyNextNavigation } from '../../testShared' describe('page des indicateurs clés', () => { diff --git a/src/components/Inventaire/action.ts b/src/components/Inventaire/action.ts index d372e92..1cc1b68 100644 --- a/src/components/Inventaire/action.ts +++ b/src/components/Inventaire/action.ts @@ -1,7 +1,7 @@ 'use server' -import { creerUnInventaireRepository, enregistrerUnInventaireNonCalculeRepository } from '../../gateways/inventairesRepository' -import { Modele } from '../../gateways/modelesRepository' +import { creerUnInventaireRepository, enregistrerUnInventaireNonCalculeRepository } from '../../repositories/inventairesRepository' +import { Modele } from '../../repositories/modelesRepository' export async function enregistrerUnInventaireNonCalculeAction(nomEtablissement: string, nomInventaire: string, modeles: ReadonlyArray): Promise { await enregistrerUnInventaireNonCalculeRepository(nomEtablissement, nomInventaire, modeles) diff --git a/src/components/Inventaire/modele.ts b/src/components/Inventaire/modele.ts index 568340b..d1dd564 100644 --- a/src/components/Inventaire/modele.ts +++ b/src/components/Inventaire/modele.ts @@ -1,4 +1,4 @@ -import { Modele } from '../../gateways/modelesRepository' +import { Modele } from '../../repositories/modelesRepository' export const modelesSelectionnes = (): Array => { const nomsModeles = document.querySelectorAll('form [data-nom-equipement]') diff --git a/src/components/Inventaires/Inventaires.test.tsx b/src/components/Inventaires/Inventaires.test.tsx index cc9dee6..7cb3318 100644 --- a/src/components/Inventaires/Inventaires.test.tsx +++ b/src/components/Inventaires/Inventaires.test.tsx @@ -2,7 +2,7 @@ import { fireEvent, screen, waitFor, within } from '@testing-library/react' import * as navigation from 'next/navigation' import PageInventaires from '../../app/(connecte)/page' -import * as repositoryInventaires from '../../gateways/inventairesRepository' +import * as repositoryInventaires from '../../repositories/inventairesRepository' import { FrozenDate, inventaireModelFactory, jeSuisUnAdmin, jeSuisUnUtilisateur, renderComponent, spyNextNavigation } from '../../testShared' describe('page inventaires', () => { diff --git a/src/components/ListeEquipements/ListeEquipements.test.tsx b/src/components/ListeEquipements/ListeEquipements.test.tsx index aed0f18..56b2812 100644 --- a/src/components/ListeEquipements/ListeEquipements.test.tsx +++ b/src/components/ListeEquipements/ListeEquipements.test.tsx @@ -2,9 +2,9 @@ import { fireEvent, screen, waitFor, within } from '@testing-library/react' import * as navigation from 'next/navigation' import PageListeEquipements from '../../app/(connecte)/(both)/liste-equipements/page' -import * as repositoryInventaires from '../../gateways/inventairesRepository' -import * as repositoryModeles from '../../gateways/modelesRepository' -import * as repositoryTypesEquipements from '../../gateways/typesEquipementsRepository' +import * as repositoryInventaires from '../../repositories/inventairesRepository' +import * as repositoryModeles from '../../repositories/modelesRepository' +import * as repositoryTypesEquipements from '../../repositories/typesEquipementsRepository' import { jeSuisUnAdmin, jeSuisUnUtilisateur, modeleModelFactory, referentielTypeEquipementModelFactory, renderComponent, spyNextNavigation } from '../../testShared' describe('page liste d’équipements', () => { diff --git a/src/components/ModifierLeNomInventaire/ModifierLeNomInventaire.test.tsx b/src/components/ModifierLeNomInventaire/ModifierLeNomInventaire.test.tsx index b16646f..601c798 100644 --- a/src/components/ModifierLeNomInventaire/ModifierLeNomInventaire.test.tsx +++ b/src/components/ModifierLeNomInventaire/ModifierLeNomInventaire.test.tsx @@ -2,7 +2,7 @@ import { fireEvent, screen, waitFor } from '@testing-library/react' import * as navigation from 'next/navigation' import PageModifierLeNomInventaire from '../../app/(connecte)/(both)/modifier-le-nom-inventaire/page' -import * as repositoryInventaires from '../../gateways/inventairesRepository' +import * as repositoryInventaires from '../../repositories/inventairesRepository' import { inventaireModelFactory, jeSuisUnAdmin, jeSuisUnUtilisateur, nomEtablissementFake, renderComponent, spyNextNavigation } from '../../testShared' describe('page modifier le nom de l’inventaire', () => { diff --git a/src/components/ModifierLeNomInventaire/action.ts b/src/components/ModifierLeNomInventaire/action.ts index 2e0c979..c9d260e 100644 --- a/src/components/ModifierLeNomInventaire/action.ts +++ b/src/components/ModifierLeNomInventaire/action.ts @@ -1,7 +1,7 @@ 'use server' import { getProfilAtih } from '../../authentification' -import { modifierLeNomInventaireRepository } from '../../gateways/inventairesRepository' +import { modifierLeNomInventaireRepository } from '../../repositories/inventairesRepository' export async function modifierLeNomInventaireAction(ancienNomInventaire: string, nouveauNomInventaire: string, nomEtablissement: string): Promise { const profil = await getProfilAtih() diff --git a/src/components/ModifierUnReferentiel/ModifierUnReferentiel.test.tsx b/src/components/ModifierUnReferentiel/ModifierUnReferentiel.test.tsx index 65f4f84..5a4cb66 100644 --- a/src/components/ModifierUnReferentiel/ModifierUnReferentiel.test.tsx +++ b/src/components/ModifierUnReferentiel/ModifierUnReferentiel.test.tsx @@ -2,7 +2,7 @@ import { fireEvent, screen } from '@testing-library/react' import { userEvent } from '@testing-library/user-event' import PageModifierUnReferentiel from '../../app/(connecte)/(admin)/modifier-un-referentiel/page' -import * as repositoryReferentiels from '../../gateways/referentielsRepository' +import * as repositoryReferentiels from '../../repositories/referentielsRepository' import { renderComponent, jeSuisUnAdmin, jeSuisUnUtilisateur, textMatch } from '../../testShared' describe('page modifier un référentiel', () => { diff --git a/src/components/ModifierUnReferentiel/action.ts b/src/components/ModifierUnReferentiel/action.ts index 7f32ca7..8b9aeb9 100644 --- a/src/components/ModifierUnReferentiel/action.ts +++ b/src/components/ModifierUnReferentiel/action.ts @@ -1,6 +1,6 @@ 'use server' -import { modifierUnReferentielRepository } from '../../gateways/referentielsRepository' +import { modifierUnReferentielRepository } from '../../repositories/referentielsRepository' export async function modifierUnReferentielAction(fichierReferentiel: FormData): Promise { await modifierUnReferentielRepository(fichierReferentiel) diff --git a/src/components/sharedComponents/action.ts b/src/components/sharedComponents/action.ts index 785d108..8139c93 100644 --- a/src/components/sharedComponents/action.ts +++ b/src/components/sharedComponents/action.ts @@ -1,7 +1,7 @@ 'use server' import { getProfilAtih } from '../../authentification' -import { supprimerUnInventaireRepository, recupererUnInventaireRepository } from '../../gateways/inventairesRepository' +import { supprimerUnInventaireRepository, recupererUnInventaireRepository } from '../../repositories/inventairesRepository' export async function supprimerInventaireAction(nomEtablissement: string, nomInventaire: string): Promise { await supprimerUnInventaireRepository(nomEtablissement, nomInventaire) diff --git a/src/presenters/indicateursClesPresenter.ts b/src/presenters/indicateursClesPresenter.ts index c9e03d0..597d9fe 100644 --- a/src/presenters/indicateursClesPresenter.ts +++ b/src/presenters/indicateursClesPresenter.ts @@ -2,8 +2,8 @@ import { indicateurImpactEquipementModel } from '@prisma/client' import { formaterDeuxChiffresApresLaVirgule, formaterLaDateEnFrancais } from './sharedPresenter' import { ProfilAtih } from '../authentification' -import { IndicateurImpactEquipementSommeModel } from '../gateways/indicateursRepository' -import { ReferentielTypeEquipementModel } from '../gateways/typesEquipementsRepository' +import { IndicateurImpactEquipementSommeModel } from '../repositories/indicateursRepository' +import { ReferentielTypeEquipementModel } from '../repositories/typesEquipementsRepository' type IndicateursImpactsEquipements = Readonly<{ acidification: string diff --git a/src/presenters/inventairePresenter.ts b/src/presenters/inventairePresenter.ts index 669f88b..978c5bf 100644 --- a/src/presenters/inventairePresenter.ts +++ b/src/presenters/inventairePresenter.ts @@ -3,7 +3,7 @@ import { modeleModel } from '@prisma/client' import { StatutsInventaire, calculerLaDureeDeVie, convertirLeTauxUtilisationEnHeureUtilisation, formaterLaDateEnFrancais, genererUnIdentifiantUnique } from './sharedPresenter' import { SearchParams } from '../app/(connecte)/(both)/inventaire/page' import { ModeleReducer } from '../components/Inventaire/useEquipement' -import { ReferentielTypeEquipementModel } from '../gateways/typesEquipementsRepository' +import { ReferentielTypeEquipementModel } from '../repositories/typesEquipementsRepository' export type EquipementAvecSesModelesPresenter = Readonly<{ modeles: Array diff --git a/src/presenters/listeEquipementsPresenter.ts b/src/presenters/listeEquipementsPresenter.ts index f65a6bc..dd9903c 100644 --- a/src/presenters/listeEquipementsPresenter.ts +++ b/src/presenters/listeEquipementsPresenter.ts @@ -1,7 +1,7 @@ import { modeleModel } from '@prisma/client' import { calculerLaDureeDeVie, convertirLeTauxUtilisationEnHeureUtilisation, formaterLaDateEnFrancais } from './sharedPresenter' -import { ReferentielTypeEquipementModel } from '../gateways/typesEquipementsRepository' +import { ReferentielTypeEquipementModel } from '../repositories/typesEquipementsRepository' export type EquipementPresenter = Readonly<{ dateInventaire: Readonly diff --git a/src/gateways/database.ts b/src/repositories/database.ts similarity index 100% rename from src/gateways/database.ts rename to src/repositories/database.ts diff --git a/src/gateways/indicateursRepository.ts b/src/repositories/indicateursRepository.ts similarity index 100% rename from src/gateways/indicateursRepository.ts rename to src/repositories/indicateursRepository.ts diff --git a/src/gateways/inventairesRepository.ts b/src/repositories/inventairesRepository.ts similarity index 100% rename from src/gateways/inventairesRepository.ts rename to src/repositories/inventairesRepository.ts diff --git a/src/gateways/modelesRepository.ts b/src/repositories/modelesRepository.ts similarity index 100% rename from src/gateways/modelesRepository.ts rename to src/repositories/modelesRepository.ts diff --git a/src/gateways/referentielsRepository.ts b/src/repositories/referentielsRepository.ts similarity index 100% rename from src/gateways/referentielsRepository.ts rename to src/repositories/referentielsRepository.ts diff --git a/src/gateways/sharedRepository.ts b/src/repositories/sharedRepository.ts similarity index 100% rename from src/gateways/sharedRepository.ts rename to src/repositories/sharedRepository.ts diff --git a/src/gateways/typesEquipementsRepository.ts b/src/repositories/typesEquipementsRepository.ts similarity index 100% rename from src/gateways/typesEquipementsRepository.ts rename to src/repositories/typesEquipementsRepository.ts diff --git a/src/testShared.ts b/src/testShared.ts index 962dedd..627072a 100644 --- a/src/testShared.ts +++ b/src/testShared.ts @@ -5,9 +5,9 @@ import { ReactElement } from 'react' import * as authentification from './authentification' import { separator } from './configuration' -import { IndicateurImpactEquipementSommeModel } from './gateways/indicateursRepository' -import { ReferentielTypeEquipementModel } from './gateways/typesEquipementsRepository' import { EtapesAcv } from './presenters/indicateursClesPresenter' +import { IndicateurImpactEquipementSommeModel } from './repositories/indicateursRepository' +import { ReferentielTypeEquipementModel } from './repositories/typesEquipementsRepository' export function renderComponent(component: ReactElement): RenderResult & { user: UserEvent } { return {