From f977f24f97b2c69273531797e4940100fd274337 Mon Sep 17 00:00:00 2001 From: Jalil Arfaoui Date: Thu, 30 May 2024 22:25:20 +0200 Subject: [PATCH] refactor: fusionne les dossiers domain et domaine --- .../RechercheEntreprisesGouvFr.ts | 14 +++++++------- .../api/RechercheEntreprise/fabrique-social.ts | 12 ++++++------ site/source/components/company/SearchDetails.tsx | 2 +- site/source/components/company/SearchField.tsx | 2 +- site/source/contexts/RepositoriesContext.ts | 2 +- site/source/domain/Établissement.ts | 9 --------- site/source/{domain => domaine}/Adresse.ts | 0 .../{domain => domaine}/AssimiléSalariéContexte.ts | 0 .../AutoentrepreneurContexte.ts | 0 site/source/{domain => domaine}/Brand.ts | 0 site/source/{domain => domaine}/CodeActivite.ts | 2 +- .../{domain => domaine}/CodeCatégorieJuridique.ts | 2 +- site/source/{domain => domaine}/Date.spec.ts | 2 +- site/source/{domain => domaine}/Date.ts | 0 site/source/{domain => domaine}/Entreprise.ts | 8 ++++---- .../{domain => domaine}/EntreprisesRepository.ts | 0 .../{domain => domaine}/IndépendantContexte.ts | 0 site/source/{domain => domaine}/Siren.ts | 2 +- site/source/domaine/Établissement.ts | 9 +++++++++ site/source/hooks/useSearchCompany.ts | 2 +- site/source/hooks/useSetEntreprise.ts | 2 +- site/source/pages/_landing/SearchOrCreate.tsx | 2 +- .../pages/assistants/pour-mon-entreprise/index.tsx | 2 +- .../simulateurs/comparaison-statuts/index.tsx | 6 +++--- .../comparaison-statuts/simulationConfig.ts | 6 +++--- site/source/store/actions/companyActions.ts | 2 +- .../store/reducers/companySituationReducer.ts | 6 +++--- 27 files changed, 47 insertions(+), 47 deletions(-) delete mode 100644 site/source/domain/Établissement.ts rename site/source/{domain => domaine}/Adresse.ts (100%) rename site/source/{domain => domaine}/AssimiléSalariéContexte.ts (100%) rename site/source/{domain => domaine}/AutoentrepreneurContexte.ts (100%) rename site/source/{domain => domaine}/Brand.ts (100%) rename site/source/{domain => domaine}/CodeActivite.ts (82%) rename site/source/{domain => domaine}/CodeCatégorieJuridique.ts (81%) rename site/source/{domain => domaine}/Date.spec.ts (95%) rename site/source/{domain => domaine}/Date.ts (100%) rename site/source/{domain => domaine}/Entreprise.ts (72%) rename site/source/{domain => domaine}/EntreprisesRepository.ts (100%) rename site/source/{domain => domaine}/IndépendantContexte.ts (100%) rename site/source/{domain => domaine}/Siren.ts (84%) create mode 100644 site/source/domaine/Établissement.ts diff --git a/site/source/api/RechercheEntreprise/RechercheEntreprisesGouvFr.ts b/site/source/api/RechercheEntreprise/RechercheEntreprisesGouvFr.ts index 9411689e6..2cf942dda 100644 --- a/site/source/api/RechercheEntreprise/RechercheEntreprisesGouvFr.ts +++ b/site/source/api/RechercheEntreprise/RechercheEntreprisesGouvFr.ts @@ -1,10 +1,10 @@ -import { CodeActivite } from '@/domain/CodeActivite' -import { CodeCatégorieJuridique } from '@/domain/CodeCatégorieJuridique' -import { IsoDate, parseIsoDateString } from '@/domain/Date' -import { Entreprise } from '@/domain/Entreprise' -import { EntreprisesRepository } from '@/domain/EntreprisesRepository' -import { Établissement } from '@/domain/Établissement' -import { Siren, Siret } from '@/domain/Siren' +import { CodeActivite } from '@/domaine/CodeActivite' +import { CodeCatégorieJuridique } from '@/domaine/CodeCatégorieJuridique' +import { IsoDate, parseIsoDateString } from '@/domaine/Date' +import { Entreprise } from '@/domaine/Entreprise' +import { EntreprisesRepository } from '@/domaine/EntreprisesRepository' +import { Établissement } from '@/domaine/Établissement' +import { Siren, Siret } from '@/domaine/Siren' /** * @see https://api.gouv.fr/documentation/api-recherche-entreprises diff --git a/site/source/api/RechercheEntreprise/fabrique-social.ts b/site/source/api/RechercheEntreprise/fabrique-social.ts index 28e8f3953..77d921fd4 100644 --- a/site/source/api/RechercheEntreprise/fabrique-social.ts +++ b/site/source/api/RechercheEntreprise/fabrique-social.ts @@ -1,9 +1,9 @@ -import { codeActivité } from '@/domain/CodeActivite' -import { codeCatégorieJuridique } from '@/domain/CodeCatégorieJuridique' -import { Entreprise } from '@/domain/Entreprise' -import { EntreprisesRepository } from '@/domain/EntreprisesRepository' -import { Établissement } from '@/domain/Établissement' -import { siren, siret } from '@/domain/Siren' +import { codeActivité } from '@/domaine/CodeActivite' +import { codeCatégorieJuridique } from '@/domaine/CodeCatégorieJuridique' +import { Entreprise } from '@/domaine/Entreprise' +import { EntreprisesRepository } from '@/domaine/EntreprisesRepository' +import { Établissement } from '@/domaine/Établissement' +import { siren, siret } from '@/domaine/Siren' export const FabriqueSocialEntreprisesRepository: EntreprisesRepository = { rechercheTexteLibre: searchDenominationOrSiren, diff --git a/site/source/components/company/SearchDetails.tsx b/site/source/components/company/SearchDetails.tsx index a90cc8340..72ca800fd 100644 --- a/site/source/components/company/SearchDetails.tsx +++ b/site/source/components/company/SearchDetails.tsx @@ -8,7 +8,7 @@ import { H4 } from '@/design-system/typography/heading' import { Entreprise, établissementEstDifférentDuSiège, -} from '@/domain/Entreprise' +} from '@/domaine/Entreprise' export default function EntrepriseSearchDetails({ entreprise, diff --git a/site/source/components/company/SearchField.tsx b/site/source/components/company/SearchField.tsx index f1bdb0f54..6e762ed44 100644 --- a/site/source/components/company/SearchField.tsx +++ b/site/source/components/company/SearchField.tsx @@ -14,7 +14,7 @@ import { Strong } from '@/design-system/typography' import { StyledLink } from '@/design-system/typography/link' import { Li, Ul } from '@/design-system/typography/list' import { Body } from '@/design-system/typography/paragraphs' -import { Entreprise } from '@/domain/Entreprise' +import { Entreprise } from '@/domaine/Entreprise' import useSearchCompany from '@/hooks/useSearchCompany' import { Appear, FromTop } from '../ui/animate' diff --git a/site/source/contexts/RepositoriesContext.ts b/site/source/contexts/RepositoriesContext.ts index 7b131b2f0..5c615d1c9 100644 --- a/site/source/contexts/RepositoriesContext.ts +++ b/site/source/contexts/RepositoriesContext.ts @@ -1,7 +1,7 @@ import { createContext } from 'react' import { RechercheEntreprisesGouvFr } from '@/api/RechercheEntreprise/RechercheEntreprisesGouvFr' -import { EntreprisesRepository } from '@/domain/EntreprisesRepository' +import { EntreprisesRepository } from '@/domaine/EntreprisesRepository' interface Repositories { entreprises: EntreprisesRepository diff --git a/site/source/domain/Établissement.ts b/site/source/domain/Établissement.ts deleted file mode 100644 index 891bd53ce..000000000 --- a/site/source/domain/Établissement.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Adresse } from '@/domain/Adresse' -import { CodeActivite } from '@/domain/CodeActivite' -import { Siret } from '@/domain/Siren' - -export interface Établissement { - siret: Siret - adresse: Adresse - activitéPrincipale: CodeActivite -} diff --git a/site/source/domain/Adresse.ts b/site/source/domaine/Adresse.ts similarity index 100% rename from site/source/domain/Adresse.ts rename to site/source/domaine/Adresse.ts diff --git a/site/source/domain/AssimiléSalariéContexte.ts b/site/source/domaine/AssimiléSalariéContexte.ts similarity index 100% rename from site/source/domain/AssimiléSalariéContexte.ts rename to site/source/domaine/AssimiléSalariéContexte.ts diff --git a/site/source/domain/AutoentrepreneurContexte.ts b/site/source/domaine/AutoentrepreneurContexte.ts similarity index 100% rename from site/source/domain/AutoentrepreneurContexte.ts rename to site/source/domaine/AutoentrepreneurContexte.ts diff --git a/site/source/domain/Brand.ts b/site/source/domaine/Brand.ts similarity index 100% rename from site/source/domain/Brand.ts rename to site/source/domaine/Brand.ts diff --git a/site/source/domain/CodeActivite.ts b/site/source/domaine/CodeActivite.ts similarity index 82% rename from site/source/domain/CodeActivite.ts rename to site/source/domaine/CodeActivite.ts index 53da8a322..cd8db48e4 100644 --- a/site/source/domain/CodeActivite.ts +++ b/site/source/domaine/CodeActivite.ts @@ -1,4 +1,4 @@ -import { Brand } from '@/domain/Brand' +import { Brand } from '@/domaine/Brand' export type CodeActivite = Brand // Pourrait être inféré des données de fetchBénéfice diff --git a/site/source/domain/CodeCatégorieJuridique.ts b/site/source/domaine/CodeCatégorieJuridique.ts similarity index 81% rename from site/source/domain/CodeCatégorieJuridique.ts rename to site/source/domaine/CodeCatégorieJuridique.ts index 4f4c949ee..e6f146707 100644 --- a/site/source/domain/CodeCatégorieJuridique.ts +++ b/site/source/domaine/CodeCatégorieJuridique.ts @@ -1,4 +1,4 @@ -import { Brand } from '@/domain/Brand' +import { Brand } from '@/domaine/Brand' export type CodeCatégorieJuridique = Brand diff --git a/site/source/domain/Date.spec.ts b/site/source/domaine/Date.spec.ts similarity index 95% rename from site/source/domain/Date.spec.ts rename to site/source/domaine/Date.spec.ts index 0ebc41efa..df8cd2a18 100644 --- a/site/source/domain/Date.spec.ts +++ b/site/source/domaine/Date.spec.ts @@ -4,7 +4,7 @@ import { parsePublicodesDateString, PublicodeDate, toPublicodeDate, -} from '@/domain/Date' +} from '@/domaine/Date' describe('parsePublicodesDateString', () => { it('comprend 24-12-2024 comme le 24 décembre 2024', () => { diff --git a/site/source/domain/Date.ts b/site/source/domaine/Date.ts similarity index 100% rename from site/source/domain/Date.ts rename to site/source/domaine/Date.ts diff --git a/site/source/domain/Entreprise.ts b/site/source/domaine/Entreprise.ts similarity index 72% rename from site/source/domain/Entreprise.ts rename to site/source/domaine/Entreprise.ts index c2ce5eb62..ea0fdfb36 100644 --- a/site/source/domain/Entreprise.ts +++ b/site/source/domaine/Entreprise.ts @@ -1,7 +1,7 @@ -import { CodeActivite } from '@/domain/CodeActivite' -import { CodeCatégorieJuridique } from '@/domain/CodeCatégorieJuridique' -import { Établissement } from '@/domain/Établissement' -import { Siren } from '@/domain/Siren' +import { CodeActivite } from '@/domaine/CodeActivite' +import { CodeCatégorieJuridique } from '@/domaine/CodeCatégorieJuridique' +import { Établissement } from '@/domaine/Établissement' +import { Siren } from '@/domaine/Siren' export interface Entreprise { nom: string diff --git a/site/source/domain/EntreprisesRepository.ts b/site/source/domaine/EntreprisesRepository.ts similarity index 100% rename from site/source/domain/EntreprisesRepository.ts rename to site/source/domaine/EntreprisesRepository.ts diff --git a/site/source/domain/IndépendantContexte.ts b/site/source/domaine/IndépendantContexte.ts similarity index 100% rename from site/source/domain/IndépendantContexte.ts rename to site/source/domaine/IndépendantContexte.ts diff --git a/site/source/domain/Siren.ts b/site/source/domaine/Siren.ts similarity index 84% rename from site/source/domain/Siren.ts rename to site/source/domaine/Siren.ts index eb1dea02a..ae09fe462 100644 --- a/site/source/domain/Siren.ts +++ b/site/source/domaine/Siren.ts @@ -1,4 +1,4 @@ -import { Brand } from '@/domain/Brand' +import { Brand } from '@/domaine/Brand' export type Siren = Brand export const siren = (value: string): Siren => value as Siren diff --git a/site/source/domaine/Établissement.ts b/site/source/domaine/Établissement.ts new file mode 100644 index 000000000..fdb85204f --- /dev/null +++ b/site/source/domaine/Établissement.ts @@ -0,0 +1,9 @@ +import { Adresse } from '@/domaine/Adresse' +import { CodeActivite } from '@/domaine/CodeActivite' +import { Siret } from '@/domaine/Siren' + +export interface Établissement { + siret: Siret + adresse: Adresse + activitéPrincipale: CodeActivite +} diff --git a/site/source/hooks/useSearchCompany.ts b/site/source/hooks/useSearchCompany.ts index b876636e7..5cd098335 100644 --- a/site/source/hooks/useSearchCompany.ts +++ b/site/source/hooks/useSearchCompany.ts @@ -1,6 +1,6 @@ import { useEffect, useState } from 'react' -import { Entreprise } from '@/domain/Entreprise' +import { Entreprise } from '@/domaine/Entreprise' import { useEntreprisesRepository } from '@/hooks/useRepositories' import { useDebounce } from './useDebounce' diff --git a/site/source/hooks/useSetEntreprise.ts b/site/source/hooks/useSetEntreprise.ts index e45cfdca6..3ec72b48b 100644 --- a/site/source/hooks/useSetEntreprise.ts +++ b/site/source/hooks/useSetEntreprise.ts @@ -2,7 +2,7 @@ import { useDispatch } from 'react-redux' import fetchBénéfice from '@/api/activité-vers-bénéfice' import { fetchCommuneDetails } from '@/api/commune' -import { Entreprise } from '@/domain/Entreprise' +import { Entreprise } from '@/domaine/Entreprise' import { addCommuneDetails, setBénéficeType, diff --git a/site/source/pages/_landing/SearchOrCreate.tsx b/site/source/pages/_landing/SearchOrCreate.tsx index 0f964081d..dc7d774a5 100644 --- a/site/source/pages/_landing/SearchOrCreate.tsx +++ b/site/source/pages/_landing/SearchOrCreate.tsx @@ -12,7 +12,7 @@ import { Grid, Spacing } from '@/design-system/layout' import PopoverConfirm from '@/design-system/popover/PopoverConfirm' import { H3 } from '@/design-system/typography/heading' import { Body } from '@/design-system/typography/paragraphs' -import { Entreprise } from '@/domain/Entreprise' +import { Entreprise } from '@/domaine/Entreprise' import { useEntreprisesRepository } from '@/hooks/useRepositories' import { useSetEntreprise } from '@/hooks/useSetEntreprise' import { useSitePaths } from '@/sitePaths' diff --git a/site/source/pages/assistants/pour-mon-entreprise/index.tsx b/site/source/pages/assistants/pour-mon-entreprise/index.tsx index 38c631ff8..d3010412f 100644 --- a/site/source/pages/assistants/pour-mon-entreprise/index.tsx +++ b/site/source/pages/assistants/pour-mon-entreprise/index.tsx @@ -32,7 +32,7 @@ import { Container, Grid, Spacing } from '@/design-system/layout' import { Strong } from '@/design-system/typography' import { H2, H3 } from '@/design-system/typography/heading' import { Body, Intro } from '@/design-system/typography/paragraphs' -import { Entreprise } from '@/domain/Entreprise' +import { Entreprise } from '@/domaine/Entreprise' import { useQuestionList } from '@/hooks/useQuestionList' import { useEntreprisesRepository } from '@/hooks/useRepositories' import { useSetEntreprise } from '@/hooks/useSetEntreprise' diff --git a/site/source/pages/simulateurs/comparaison-statuts/index.tsx b/site/source/pages/simulateurs/comparaison-statuts/index.tsx index 27f89728c..5f91a2464 100644 --- a/site/source/pages/simulateurs/comparaison-statuts/index.tsx +++ b/site/source/pages/simulateurs/comparaison-statuts/index.tsx @@ -7,9 +7,9 @@ import { Emoji } from '@/design-system/emoji' import { Strong } from '@/design-system/typography' import { Link } from '@/design-system/typography/link' import { Body, Intro } from '@/design-system/typography/paragraphs' -import { AssimiléSalariéContexte } from '@/domain/AssimiléSalariéContexte' -import { AutoentrepreneurContexte } from '@/domain/AutoentrepreneurContexte' -import { IndépendantContexte } from '@/domain/IndépendantContexte' +import { AssimiléSalariéContexte } from '@/domaine/AssimiléSalariéContexte' +import { AutoentrepreneurContexte } from '@/domaine/AutoentrepreneurContexte' +import { IndépendantContexte } from '@/domaine/IndépendantContexte' import { useSitePaths } from '@/sitePaths' import Comparateur from './components/Comparateur' diff --git a/site/source/pages/simulateurs/comparaison-statuts/simulationConfig.ts b/site/source/pages/simulateurs/comparaison-statuts/simulationConfig.ts index aa266be4c..7908f1e19 100644 --- a/site/source/pages/simulateurs/comparaison-statuts/simulationConfig.ts +++ b/site/source/pages/simulateurs/comparaison-statuts/simulationConfig.ts @@ -1,7 +1,7 @@ -import { AssimiléSalariéContexte } from '@/domain/AssimiléSalariéContexte' -import { AutoentrepreneurContexte } from '@/domain/AutoentrepreneurContexte' -import { IndépendantContexte } from '@/domain/IndépendantContexte' +import { AssimiléSalariéContexte } from '@/domaine/AssimiléSalariéContexte' +import { AutoentrepreneurContexte } from '@/domaine/AutoentrepreneurContexte' import { ComparateurConfig } from '@/domaine/ComparateurConfig' +import { IndépendantContexte } from '@/domaine/IndépendantContexte' export const configComparateurStatuts: ComparateurConfig = { contextes: [ diff --git a/site/source/store/actions/companyActions.ts b/site/source/store/actions/companyActions.ts index 99a7929e2..d3ad577fb 100644 --- a/site/source/store/actions/companyActions.ts +++ b/site/source/store/actions/companyActions.ts @@ -1,6 +1,6 @@ import { Bénéfice } from '@/api/activité-vers-bénéfice' import { Commune } from '@/api/commune' -import { Entreprise } from '@/domain/Entreprise' +import { Entreprise } from '@/domaine/Entreprise' export type CompanyActions = ReturnType< | typeof resetCompany diff --git a/site/source/store/reducers/companySituationReducer.ts b/site/source/store/reducers/companySituationReducer.ts index d359613e1..37587853f 100644 --- a/site/source/store/reducers/companySituationReducer.ts +++ b/site/source/store/reducers/companySituationReducer.ts @@ -1,8 +1,8 @@ import { DottedName } from 'modele-social' -import { CodeCatégorieJuridique } from '@/domain/CodeCatégorieJuridique' -import { toPublicodeDate } from '@/domain/Date' -import { Entreprise } from '@/domain/Entreprise' +import { CodeCatégorieJuridique } from '@/domaine/CodeCatégorieJuridique' +import { toPublicodeDate } from '@/domaine/Date' +import { Entreprise } from '@/domaine/Entreprise' import { Action } from '@/store/actions/actions' import { buildSituationFromObject, omit } from '@/utils'