From dc6f52af2e7d88650cd16d2ee492a4c9556f8d2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Bitard?= <bitard.michael@gmail.com> Date: Thu, 28 Apr 2022 10:50:17 +0200 Subject: [PATCH] =?UTF-8?q?refactor(administrations):=20supprime=20les=20a?= =?UTF-8?q?dministrations=20de=20la=20base=20de=20donn=C3=A9es=20(#43)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * refactor(administrations): supprime les administrations de la base de données * refactor(administrations): supprime les administrations de la base de données * test front ok * fix unit tests * fix build * nettoyage * correction des tests * update administrations const * fix(test): accepte les nouveaux tests unitaires Co-authored-by: vmaubert <v.maubert@code-troopers.com> --- packages/api/jest.config.ts | 13 +- packages/api/package.json | 3 +- .../api/sources/administrations-types.json | 32 - packages/api/sources/administrations.json | 1762 ------ .../api/src/api/_format/administrations.ts | 23 +- packages/api/src/api/_format/titres.ts | 6 +- packages/api/src/api/_format/utilisateurs.ts | 8 +- packages/api/src/api/graphql/resolvers.ts | 4 - .../api/graphql/resolvers/administrations.ts | 108 +- .../api/src/api/graphql/resolvers/metas.ts | 46 +- .../graphql/schemas/administrations.graphql | 48 +- .../api/src/api/graphql/schemas/index.graphql | 16 +- .../api/src/api/graphql/schemas/metas.graphql | 6 - packages/api/src/business/_logs-update.ts | 9 - .../api/src/business/administration-update.ts | 8 +- packages/api/src/business/monthly.ts | 8 - .../__mocks__/administrations-update.ts | 32 - .../processes/administrations-update.test.ts | 81 - .../processes/administrations-update.ts | 99 - ...es-administrations-gestionnaires-update.ts | 2 +- ...s-etapes-administrations-locales-update.ts | 2 +- .../titre-slug-and-relations-update.test.ts | 6 +- .../database/models/administrations-types.ts | 28 - .../src/database/models/administrations.ts | 25 +- packages/api/src/database/queries/_options.ts | 19 +- .../src/database/queries/administrations.ts | 132 +- .../database/queries/graph/fields-format.ts | 27 +- packages/api/src/database/queries/metas.ts | 12 - .../permissions/administrations.test.ts | 6 +- .../queries/permissions/administrations.ts | 12 - .../queries/permissions/documents.test.ts | 7 +- .../queries/permissions/entreprises.test.ts | 6 +- .../queries/permissions/metas.test.ts | 12 +- .../permissions/titres-demarches.test.ts | 7 +- .../queries/permissions/titres-etapes.test.ts | 6 +- .../queries/permissions/titres.test.ts | 38 +- .../queries/permissions/utilisateurs.test.ts | 25 +- .../database/queries/titres-activites.test.ts | 6 +- .../database/queries/titres-demarches.test.ts | 6 +- .../api/src/database/queries/titres.test.ts | 6 +- .../20220427075921_administrations_delete.js | 20 + .../api/src/knex/seeds/07-administrations.js | 13 +- .../api/src/scripts/administrations-update.ts | 60 + .../src/tools/api-administrations/index.ts | 125 +- .../api/src/tools/database-to-json/tables.ts | 2 - packages/api/src/types.ts | 27 +- packages/api/tests/_utils/administrations.ts | 112 +- packages/api/tests/administration.test.ts | 87 +- ...inistrations-permissions-demarches.test.ts | 36 +- ...administrations-permissions-etapes.test.ts | 6 +- ...administrations-permissions-titres.test.ts | 6 +- packages/api/tests/db-manager.ts | 53 +- packages/api/tests/documents.test.ts | 10 +- packages/api/tests/entreprises.test.ts | 9 +- packages/api/tests/metas.test.ts | 6 +- .../queries/administration-modifier.graphql | 91 - packages/api/tests/setup.ts | 2 - packages/api/tests/teardown.ts | 5 - packages/api/tests/titres-demarches.test.ts | 9 +- .../api/tests/titres-etapes-creer.test.ts | 6 +- .../api/tests/titres-etapes-modifier.test.ts | 6 +- packages/api/tests/titres.test.ts | 9 +- packages/api/tests/token.test.ts | 6 +- packages/api/tests/upload.test.ts | 6 +- packages/api/tests/utilisateurs.test.ts | 26 +- packages/api/tsconfig.json | 1 - packages/common/src/administrations.test.ts | 6 + .../common/src/administrations.test.ts.md | 42 + .../common/src/administrations.test.ts.snap | Bin 0 -> 445 bytes packages/common/src/administrations.ts | 1939 ++++++ packages/common/src/departement.ts | 621 ++ packages/common/src/region.ts | 121 + packages/ui/src/api/administrations.js | 60 - .../ui/src/api/fragments/administration.js | 15 - .../ui/src/api/fragments/administrations.js | 1 - packages/ui/src/api/fragments/metas.js | 9 - packages/ui/src/api/metas.js | 25 - packages/ui/src/api/titres.js | 6 - packages/ui/src/api/utilisateurs.js | 9 - .../administrations.stories.storyshot | 5395 +++++++++++++++++ packages/ui/src/components/administration.vue | 54 +- .../components/administration/edit-popup.vue | 360 -- .../components/administration/permissions.vue | 4 +- .../src/components/administrations.stories.ts | 22 + .../ui/src/components/administrations.vue | 215 +- .../src/components/administrations/filtres.js | 21 - .../src/components/administrations/table.js | 40 - .../ui/src/components/titre/edit-popup.vue | 5 +- packages/ui/src/components/utilisateur.vue | 2 +- .../src/components/utilisateur/edit-popup.vue | 81 +- packages/ui/src/components/utilisateurs.vue | 6 +- packages/ui/src/store/administration.js | 31 +- packages/ui/src/store/administration.test.js | 71 - packages/ui/src/store/administrations.js | 54 - packages/ui/src/store/administrations.test.js | 46 - packages/ui/src/store/index.js | 2 - packages/ui/src/store/index.test.js | 1 - packages/ui/src/store/metas-definitions.js | 12 - packages/ui/src/store/titre.js | 7 +- packages/ui/src/store/titre.test.js | 10 +- packages/ui/src/store/utilisateur.js | 5 +- packages/ui/src/store/utilisateur.test.js | 9 +- packages/ui/src/store/utilisateurs.js | 6 - packages/ui/src/store/utilisateurs.test.js | 16 +- 104 files changed, 8803 insertions(+), 3967 deletions(-) delete mode 100644 packages/api/sources/administrations-types.json delete mode 100644 packages/api/sources/administrations.json delete mode 100644 packages/api/src/business/processes/__mocks__/administrations-update.ts delete mode 100644 packages/api/src/business/processes/administrations-update.test.ts delete mode 100644 packages/api/src/business/processes/administrations-update.ts delete mode 100644 packages/api/src/database/models/administrations-types.ts create mode 100644 packages/api/src/knex/migrations-schema/20220427075921_administrations_delete.js create mode 100644 packages/api/src/scripts/administrations-update.ts delete mode 100644 packages/api/tests/queries/administration-modifier.graphql delete mode 100644 packages/api/tests/teardown.ts create mode 100644 packages/common/src/administrations.test.ts create mode 100644 packages/common/src/administrations.test.ts.md create mode 100644 packages/common/src/administrations.test.ts.snap create mode 100644 packages/common/src/administrations.ts create mode 100644 packages/common/src/departement.ts create mode 100644 packages/common/src/region.ts create mode 100644 packages/ui/src/components/__snapshots__/administrations.stories.storyshot delete mode 100644 packages/ui/src/components/administration/edit-popup.vue create mode 100644 packages/ui/src/components/administrations.stories.ts delete mode 100644 packages/ui/src/components/administrations/filtres.js delete mode 100644 packages/ui/src/components/administrations/table.js delete mode 100644 packages/ui/src/store/administrations.js delete mode 100644 packages/ui/src/store/administrations.test.js diff --git a/packages/api/jest.config.ts b/packages/api/jest.config.ts index e828bf48e..e34c10457 100644 --- a/packages/api/jest.config.ts +++ b/packages/api/jest.config.ts @@ -51,12 +51,13 @@ const config: Config.InitialOptions = { globalSetup: './tests/setup.ts', // A path to a module which exports an async function that is triggered once after all test suites - globalTeardown: './tests/teardown.ts', + // globalTeardown: './tests/teardown.ts', // A set of global variables that need to be available in all test environments globals: { 'ts-jest': { - isolatedModules: true + isolatedModules: true, + diagnostics: false } }, // extensionsToTreatAsEsm: ['.ts'], @@ -155,13 +156,13 @@ const config: Config.InitialOptions = { // timers: "real", // A map from regular expressions to paths to transformers - // transform: { - // '^.+\\.tsx?$': 'babel-jest' - // }, + transform: { + '^.+\\.ts?$': 'ts-jest' + }, maxWorkers: 1, // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation - transformIgnorePatterns: ['<rootDir>/node_modules/', '<rootDir>/knex/*'], + transformIgnorePatterns: ['<rootDir>/node_modules/'], // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them // unmockedModulePathPatterns: undefined, diff --git a/packages/api/package.json b/packages/api/package.json index 11ce0aa24..575ea6f38 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -31,7 +31,7 @@ "start": "node ./dist/src/index.js", "test": "cross-env jest --testPathIgnorePatterns=tests --runInBand --detectOpenHandles --forceExit", "test:unit": "cross-env jest --testPathIgnorePatterns=tests --runInBand --detectOpenHandles --watch", - "test:integration": "cross-env JWT_SECRET=secret-tests jest --testPathIgnorePatterns=src --runInBand --detectOpenHandles --watch --testTimeout=20000", + "test:integration": "cross-env JWT_SECRET=secret-tests JWT_SECRET_REFRESH=refresh-secret jest --testPathIgnorePatterns=src --runInBand --detectOpenHandles --watch --testTimeout=20000", "ci:lint": "prettier --check . && eslint .", "ci:test-unit": "cross-env jest --testPathIgnorePatterns=tests --ci --runInBand --detectOpenHandles --forceExit --testTimeout=20000", "ci:test-integration": "cross-env JWT_SECRET=secret-tests JWT_SECRET_REFRESH=refresh-secret jest --testPathIgnorePatterns=src --runInBand --detectOpenHandles --ci --forceExit --testTimeout=20000", @@ -176,6 +176,7 @@ "no-return-await": "error", "default-param-last": 0, "no-unused-vars": 0, + "camelcase": 0, "no-restricted-syntax": [ "error", { diff --git a/packages/api/sources/administrations-types.json b/packages/api/sources/administrations-types.json deleted file mode 100644 index a71931113..000000000 --- a/packages/api/sources/administrations-types.json +++ /dev/null @@ -1,32 +0,0 @@ -[ - { - "id": "aut", - "nom": "Autorité", - "ordre": 6 - }, - { - "id": "dea", - "nom": "Déal", - "ordre": 3 - }, - { - "id": "dre", - "nom": "Dréal", - "ordre": 2 - }, - { - "id": "min", - "nom": "Ministère", - "ordre": 1 - }, - { - "id": "ope", - "nom": "Opérateur", - "ordre": 5 - }, - { - "id": "pre", - "nom": "Préfecture", - "ordre": 4 - } -] \ No newline at end of file diff --git a/packages/api/sources/administrations.json b/packages/api/sources/administrations.json deleted file mode 100644 index 3d4347c11..000000000 --- a/packages/api/sources/administrations.json +++ /dev/null @@ -1,1762 +0,0 @@ -[ - { - "id": "aut-97300-01", - "type_id": "aut", - "nom": "Gendarmerie Nationale - Guyane", - "abreviation": "Gendarmerie Nationale - Guyane", - "service": "Centre de conduite des Opérations", - "url": "https://www.gendarmerie.interieur.gouv.fr/", - "email": "cco.comgendgf@gendarmerie.interieur.gouv.fr", - "telephone": "+594 29 28 00", - "adresse1": "Caserne La Madeleine", - "adresse2": "1296 Route de la Madeleine", - "code_postal": "97300", - "commune": "Cayenne" - }, - { - "id": "aut-mrae-guyane-01", - "type_id": "aut", - "nom": "Mission régionale autorité environnementale de Guyane", - "abreviation": "MRAE Guyane", - "url": "http://www.mrae.developpement-durable.gouv.fr/guyane-r27.html", - "telephone": "+594 (0)5 94 39 80 00", - "adresse1": "Route du Vieux-Port\n97300 Cayenne", - "adresse2": "Adresse postale\nRoute du Vieux-Port\nCS 76003\n97306 Cayenne", - "code_postal": "97300", - "commune": "Cayenne", - "cedex": "Cedex", - "region_id": "03" - }, - { - "id": "dea-guadeloupe-01", - "type_id": "dea", - "nom": "Direction de l'environnement de l'aménagement et du logement (DEAL) - Guadeloupe", - "abreviation": "DEAL - Guadeloupe", - "url": "http://www.guadeloupe.developpement-durable.gouv.fr", - "email": "deal-guadeloupe@developpement-durable.gouv.fr", - "telephone": "+33 (0)5 90 99 46 46", - "adresse1": "Route de St Phy\n97102 Basse-Terre", - "adresse2": "Adresse postale\r\nDEAL Guadeloupe\nBP 54\n97102 Basse-Terre", - "code_postal": "97102", - "commune": "Basse-Terre", - "cedex": "Cedex", - "region_id": "01" - }, - { - "id": "dea-guyane-01", - "type_id": "dea", - "nom": "Direction Générale des Territoires et de la Mer de Guyane", - "abreviation": "DGTM - Guyane", - "url": "http://www.guyane.developpement-durable.gouv.fr", - "telephone": "+594 5 94 39 80 00", - "adresse1": "Route du Vieux-Port\n97300 Cayenne", - "adresse2": "Adresse postale\nRoute du Vieux-Port\nCS 76003\n97306 Cayenne", - "code_postal": "97300", - "commune": "Cayenne", - "cedex": "Cedex", - "region_id": "03" - }, - { - "id": "dea-martinique-01", - "type_id": "dea", - "nom": "Direction de l'environnement de l'aménagement et du logement (DEAL) - Martinique", - "abreviation": "DEAL - Martinique", - "url": "http://www.martinique.developpement-durable.gouv.fr", - "email": "deal-martinique-usagers@developpement-durable.gouv.fr", - "telephone": "+33 (0)5 96 59 57 00", - "adresse1": "B.P. 7212\n97274 Schœlcher", - "code_postal": "97274", - "commune": "Schœlcher", - "cedex": "Cedex", - "region_id": "02" - }, - { - "id": "dea-mayotte-01", - "type_id": "dea", - "nom": "Direction de l'environnement de l'aménagement et du logement (DEAL) - Mayotte", - "abreviation": "DEAL - Mayotte", - "url": "http://www.mayotte.gouv.fr/Services-de-l-Etat/Direction-de-l-Environnement-de-l-Amenagement-et-du-Logement-DEAL", - "email": "de-mayotte@equipement.gouv.fr", - "telephone": "+262 269 61 12 54", - "adresse1": "Terre plein de M'Tsapéré\n97600 Mamoudzou", - "adresse2": "Adresse postale\nBP 109\n97600 Mamoudzou", - "code_postal": "97600", - "commune": "Mamoudzou", - "cedex": "Cedex", - "region_id": "06" - }, - { - "id": "dea-reunion-01", - "type_id": "dea", - "nom": "Direction de l'environnement de l'aménagement et du logement (DEAL) - La Réunion", - "abreviation": "DEAL - La Réunion", - "url": "http://www.reunion.developpement-durable.gouv.fr", - "email": "deal-reunion@developpement-durable.gouv.fr", - "telephone": "+33 (0)2 62 40 26 26", - "adresse1": "2 rue Juliette Dodu\nCS 41009\r\n97743 Saint-Denis", - "code_postal": "97743", - "commune": "Saint-Denis", - "cedex": "Cedex", - "region_id": "04" - }, - { - "id": "dre-aura-01", - "type_id": "dre", - "nom": "Direction régionale de l'environnement, de l'aménagement et du logement (DREAL) - Auvergne-Rhône-Alpes - Siège de Lyon", - "abreviation": "DREAL - Auvergne-Rhône-Alpes - Siège de Lyon", - "url": "http://www.auvergne-rhone-alpes.developpement-durable.gouv.fr", - "email": "dir.dreal-auvergne-rhone-alpes@developpement-durable.gouv.fr", - "telephone": "+33 (0)4 26 28 60 00", - "adresse1": "5 place Jules-Ferry\n69006 Lyon", - "adresse2": "Adresse postale\nDreal Rhône-Alpes\n69453 Lyon Cedex 6", - "code_postal": "69006", - "commune": "Lyon", - "cedex": "Cedex", - "region_id": "84" - }, - { - "id": "dre-bfc-01", - "type_id": "dre", - "nom": "Direction régionale de l'environnement, de l'aménagement et du logement (DREAL) - Bourgogne-Franche-Comté - Siège de Besançon", - "abreviation": "DREAL - Bourgogne-Franche-Comté - Siège de Besançon", - "url": "http://www.bourgogne-franche-comte.developpement-durable.gouv.fr", - "telephone": "+33 (0)3 39 59 62 00", - "adresse1": "5 voie Gisèle Halimi", - "adresse2": "BP 31269 ", - "code_postal": "25005", - "commune": "Besançon", - "cedex": "Cedex", - "region_id": "27" - }, - { - "id": "dre-bretagne-01", - "type_id": "dre", - "nom": "Direction régionale de l'environnement, de l'aménagement et du logement (DREAL) - Bretagne", - "abreviation": "DREAL - Bretagne", - "url": "http://www.bretagne.developpement-durable.gouv.fr", - "email": "dreal-bretagne@developpement-durable.gouv.fr", - "telephone": "+33 (0)2 99 33 45 55", - "adresse1": "10 rue Maurice-Fabre\nCS 96515\n35065 Rennes", - "code_postal": "35065", - "commune": "Rennes", - "cedex": "Cedex", - "region_id": "53" - }, - { - "id": "dre-centre-val-de-loire-01", - "type_id": "dre", - "nom": "Direction régionale de l'environnement, de l'aménagement et du logement (DREAL) - Centre-Val-de-Loire", - "abreviation": "DREAL - Centre-Val-de-Loire", - "url": "http://www.centre.developpement-durable.gouv.fr", - "email": "dreal-centre@developpement-durable.gouv.fr", - "telephone": "+33 (0)2 36 17 41 41", - "adresse1": "5 avenue Buffon\nCS 96407\n45064 Orléans", - "code_postal": "45064", - "commune": "Orléans", - "cedex": "Cedex", - "region_id": "24" - }, - { - "id": "dre-corse-01", - "type_id": "dre", - "nom": "Direction régionale de l'environnement, de l'aménagement et du logement (DREAL) - Corse", - "abreviation": "DREAL - Corse", - "url": "http://www.corse.developpement-durable.gouv.fr", - "email": "dreal-corse@developpement-durable.gouv.fr", - "telephone": "+33 (0)4 95 51 79 70", - "adresse1": "19 cours Napoléon\nBâtiment D\nCS 10006\n20704 Ajaccio", - "code_postal": "20704", - "commune": "Ajaccio", - "cedex": "Cedex", - "region_id": "94" - }, - { - "id": "dre-grand-est-01", - "type_id": "dre", - "nom": "Direction régionale de l'environnement, de l'aménagement et du logement (DREAL) - Grand Est - Siège de Metz", - "abreviation": "DREAL - Grand Est - Siège de Metz", - "url": "http://www.grand-est.developpement-durable.gouv.fr", - "telephone": "+33 (0)3 87 62 81 00", - "adresse1": "Greenpark\n2 rue Augustin-Fresnel\nBP 95038\n57071 Metz", - "code_postal": "57071", - "commune": "Metz", - "cedex": "Cedex", - "region_id": "44" - }, - { - "id": "dre-hauts-de-france-01", - "type_id": "dre", - "nom": "Direction régionale de l'environnement, de l'aménagement et du logement (DREAL) - Hauts-de-France - Siège de Lille", - "abreviation": "DREAL - Hauts-de-France - Siège de Lille", - "url": "http://www.hauts-de-france.developpement-durable.gouv.fr", - "telephone": "+33 (0)3 20 13 48 48", - "adresse1": "44 rue de Tournai\nCS 40259\n59019 Lille", - "code_postal": "59019", - "commune": "Lille", - "cedex": "Cedex", - "region_id": "32" - }, - { - "id": "dre-ile-de-france-01", - "type_id": "dre", - "nom": "Direction régionale et interdépartementale de l'environnement et de l'énergie (DRIEE) - Île-de-France", - "abreviation": "DRIEE - Île-de-France", - "url": "http://www.driee.ile-de-france.developpement-durable.gouv.fr", - "email": "driee-if@developpement-durable.gouv.fr", - "telephone": "+33 (0)1 87 36 45 00", - "adresse1": "12 cours Louis Lumière, CS 70027", - "code_postal": "94307", - "commune": "Vincennes", - "cedex": "cedex", - "region_id": "11" - }, - { - "id": "dre-normandie-01", - "type_id": "dre", - "nom": "Direction régionale de l'environnement, de l'aménagement et du logement (DREAL) - Normandie - Siège de Rouen", - "abreviation": "DREAL - Normandie - Siège de Rouen", - "url": "http://www.normandie.developpement-durable.gouv.fr", - "email": "dreal-hnormandie@developpement-durable.gouv.fr", - "telephone": "+33 (0)2 35 58 53 27", - "adresse1": "BP 86002\nCité administrative\n2 rue Saint-Sever\n76032 Rouen", - "code_postal": "76032", - "commune": "Rouen", - "cedex": "Cedex", - "region_id": "28" - }, - { - "id": "dre-nouvelle-aquitaine-01", - "type_id": "dre", - "nom": "Direction régionale de l'environnement, de l'aménagement et du logement (DREAL) - Nouvelle-Aquitaine - Siège de Poitiers", - "abreviation": "DREAL - Nouvelle-Aquitaine - Siège de Poitiers", - "url": "http://www.nouvelle-aquitaine.developpement-durable.gouv.fr", - "telephone": "+33 (0)5 49 55 63 63", - "adresse1": "15 rue Arthur-Ranc\nBP 60539\n86020 Poitiers", - "code_postal": "86020", - "commune": "Poitiers", - "cedex": "Cedex", - "region_id": "75" - }, - { - "id": "dre-occitanie-01", - "type_id": "dre", - "nom": "Direction régionale de l'environnement, de l'aménagement et du logement (DREAL) - Occitanie - Siège de Toulouse", - "abreviation": "DREAL - Occitanie - Siège de Toulouse", - "url": "http://www.occitanie.developpement-durable.gouv.fr", - "telephone": "+33 (0)5 61 58 50 00", - "adresse1": "1 rue de la Cité-Administrative\nBâtiment G\nCS 80002\n31074 Toulouse", - "code_postal": "31074", - "commune": "Toulouse", - "cedex": "Cedex", - "region_id": "76" - }, - { - "id": "dre-paca-01", - "type_id": "dre", - "nom": "Direction régionale de l'environnement, de l'aménagement et du logement (DREAL) - Provence-Alpes-Côte-d'Azur", - "abreviation": "DREAL - Provence-Alpes-Côte-d'Azur", - "url": "http://www.paca.developpement-durable.gouv.fr", - "telephone": "+33 (0)4 91 28 40 40", - "adresse1": "16 rue Antoine-Zattara\nCS 70248\n13331 Marseille", - "code_postal": "13331", - "commune": "Marseille", - "cedex": "Cedex", - "region_id": "93" - }, - { - "id": "dre-pays-de-la-loire-01", - "type_id": "dre", - "nom": "Direction régionale de l'environnement, de l'aménagement et du logement (DREAL) - Pays de la Loire", - "abreviation": "DREAL - Pays de la Loire", - "url": "http://www.pays-de-la-loire.developpement-durable.gouv.fr", - "email": "dreal-pays-de-la-loire@developpement-durable.gouv.fr", - "telephone": "+33 (0)2 72 74 73 00", - "adresse1": "5 rue Françoise-Giroud\nCS 16326\n44263 Nantes", - "code_postal": "44263", - "commune": "Nantes", - "cedex": "Cedex", - "region_id": "52" - }, - { - "id": "min-dajb-01", - "type_id": "min", - "nom": "Ministère de l'Economie, des Finances et de la Relance", - "abreviation": "DAJ - Ministère de l'Economie, des Finances et de la Relance", - "service": "Bureau 4C. Droit de l'industrie, de l'énergie et des réseaux de communication", - "url": "http://www.economie.gouv.fr", - "telephone": "01 44 97 03 32", - "adresse1": "6 rue Louise-Weiss", - "adresse2": "Télédoc 342", - "code_postal": "75703", - "commune": "Paris", - "cedex": "Cedex 13" - }, - { - "id": "min-mctrct-dgcl-01", - "type_id": "min", - "nom": "Ministère de la Cohésion des Territoires et des Relations avec les Collectivités Territoriales", - "abreviation": "DGCL/SDFLAE/FL1", - "service": "Bureau de la fiscalité locale", - "url": "https://www.cohesion-territoires.gouv.fr/direction-generale-des-collectivites-locales", - "telephone": "01 49 27 31 59", - "adresse1": "2 place des Saussaies", - "code_postal": "75800", - "commune": "Paris" - }, - { - "id": "min-mtes-dgaln-01", - "type_id": "min", - "nom": "Ministère de l'Economie, des Finances et de la Relance & Ministère de la Transition écologique", - "abreviation": "DGALN/DEB/EARM2", - "service": "Bureau de la politique des ressources minérales non énergétiques - Direction générale de l'aménagement, du logement et de la nature (DGALN)", - "url": "http://www.mineralinfo.fr", - "email": "earm2.deb.dgaln@developpement-durable.gouv.fr", - "telephone": "+33 (0)1 40 81 21 22", - "adresse1": "Tour Séquoia", - "adresse2": "1 place Carpeaux", - "code_postal": "92055", - "commune": "Paris-La-Défense", - "cedex": "Cedex" - }, - { - "id": "min-mtes-dgec-01", - "type_id": "min", - "nom": "Ministère de l'Economie, des Finances et de la Relance & Ministère de la Transition écologique", - "abreviation": "DGEC/DE/SD2/2A", - "service": "Bureau Ressources énergétiques du sous-sol (2A) - Direction générale de l'énergie et du climat (DGEC)", - "url": "http://www.minergies.fr", - "email": "2a.sd2.de.dgec@developpement-durable.gouv.fr", - "telephone": "+33 (0)1 40 81 95 63", - "adresse1": "Tour Séquoia\n1 place Carpeaux\n92800 Puteaux", - "adresse2": "Adresse postale\r\n92055 Paris-La-Défense Cedex", - "code_postal": "92800", - "commune": "Puteaux", - "cedex": "Cedex" - }, - { - "id": "min-mtes-dgpr-01", - "type_id": "min", - "nom": "Ministère de l'Economie, des Finances et de la Relance & Ministère de la Transition écologique", - "abreviation": "DGPR/SRT/SDRCP/BSSS", - "service": "Bureau du sol et du sous-sol - Direction générale de la prévention des risques (DGPR)", - "email": "bsss.sdrcp.srt.dgpr@developpement-durable.gouv.fr", - "telephone": "+33 (0)1 40 81 21 22", - "adresse1": "Tour Séquoia\n1 place Carpeaux\n92800 Puteaux", - "adresse2": "Adresse postale\n92055 Paris-La-Défense Cedex", - "code_postal": "92800", - "commune": "Puteaux", - "cedex": "Cedex" - }, - { - "id": "ope-brgm-01", - "type_id": "ope", - "nom": "Bureau de recherches géologiques et minières", - "abreviation": "BRGM", - "url": "https://www.brgm.fr/", - "telephone": "02 38 64 34 34", - "adresse1": "3 avenue Claude-Guillemin", - "adresse2": "BP 36009", - "code_postal": "45060", - "commune": "Orléans", - "cedex": "Cedex 2" - }, - { - "id": "ope-brgm-02", - "type_id": "ope", - "nom": "BRGM - Projet Zercoa", - "abreviation": "BRGM - Projet Zercoa", - "service": "BRGM - Equipe projet \"zones favorables à une exploitation et à un réaménagement coordonné de l'or alluvionnaire\"", - "url": "https://www.brgm.fr//", - "telephone": "02 38 64 34 34", - "adresse1": "3 avenue Claude-Guillemin", - "adresse2": "BP 36009", - "code_postal": "45060", - "commune": "Orléans", - "cedex": "Cedex 2" - }, - { - "id": "ope-cacem-01", - "type_id": "ope", - "nom": "Centre d'appui au contrôle de l'environnement marin", - "abreviation": "Cacem", - "service": "DIRM NAMO/DOSM/CROSS Etel/CACEM", - "url": "http://extranet.legicem.metier.developpement-durable.gouv.fr", - "email": "cacem@developpement-durable.gouv.fr", - "adresse1": "Centre régional opérationnel de surveillance et de sauvetage Atlantique", - "adresse2": "40 avenue L. Bougo", - "code_postal": "56410", - "commune": "Etel" - }, - { - "id": "ope-onf-973-01", - "type_id": "ope", - "nom": "Office national des forêts", - "abreviation": "Office national des forêts", - "service": "Direction territoriale Guyane", - "url": "http://www1.onf.fr/guyane/@@index.html", - "email": "pole.minier@onf.fr", - "telephone": "+594 (0)5 94 25 53 78", - "adresse1": "541 route de Montabo", - "adresse2": "Adresse postale\r\n541 route de Montabo\nCS87002", - "code_postal": "97300", - "commune": "Cayenne", - "region_id": "03" - }, - { - "id": "ope-ptmg-973-01", - "type_id": "ope", - "nom": "Pôle Technique Minier de Guyane", - "abreviation": "Pôle Technique Minier de Guyane", - "telephone": "+594 (0)5 94 30 06 00", - "adresse1": "Hôtel de la Collectivité Territoriale de Guyane, Carrefour de Suzini", - "adresse2": "4179 route de Montabo", - "code_postal": "97307", - "commune": "Cayenne" - }, - { - "id": "pre-01053-01", - "type_id": "pre", - "nom": "Préfecture - Ain", - "abreviation": "Préfecture - Ain", - "url": "http://www.ain.gouv.fr", - "email": "prefecture@ain.gouv.fr", - "telephone": "04 74 32 30 00", - "adresse1": "45, avenue d'Alsace-Lorraine, CS 80400, Quartier Bourg centre", - "code_postal": "01012", - "commune": "Bourg-en-Bresse Cedex", - "cedex": "Cedex", - "departement_id": "01" - }, - { - "id": "pre-02408-01", - "type_id": "pre", - "nom": "Préfecture - Aisne", - "abreviation": "Préfecture - Aisne", - "url": "http://www.aisne.gouv.fr", - "email": "prefecture@aisne.gouv.fr", - "telephone": "03 23 21 82 82", - "adresse1": "2, rue Paul-Doumer", - "code_postal": "02010", - "commune": "Laon Cedex", - "cedex": "Cedex", - "departement_id": "02" - }, - { - "id": "pre-03190-01", - "type_id": "pre", - "nom": "Préfecture - Allier", - "abreviation": "Préfecture - Allier", - "url": "http://www.allier.gouv.fr", - "email": "prefecture@allier.gouv.fr", - "telephone": "04 70 48 30 00", - "adresse1": "2, rue Michel-de-L'Hospital, CS 31649", - "code_postal": "03016", - "commune": "Moulins Cedex", - "cedex": "Cedex", - "departement_id": "03" - }, - { - "id": "pre-04070-01", - "type_id": "pre", - "nom": "Préfecture - Alpes-de-Haute-Provence", - "abreviation": "Préfecture - Alpes-de-Haute-Provence", - "url": "http://www.alpes-de-haute-provence.gouv.fr", - "telephone": "04 92 36 72 00", - "adresse1": "8, rue Docteur-Romieu", - "code_postal": "04016", - "commune": "Digne-les-Bains Cedex", - "cedex": "Cedex", - "departement_id": "04" - }, - { - "id": "pre-05061-01", - "type_id": "pre", - "nom": "Préfecture - Hautes-Alpes", - "abreviation": "Préfecture - Hautes-Alpes", - "url": "http://www.hautes-alpes.gouv.fr", - "email": "prefecture@hautes-alpes.gouv.fr", - "telephone": "04 92 40 48 00", - "adresse1": "28, rue Saint-Arey, CS 66002", - "code_postal": "05011", - "commune": "Gap Cedex", - "cedex": "Cedex", - "departement_id": "05" - }, - { - "id": "pre-06088-01", - "type_id": "pre", - "nom": "Préfecture - Alpes-Maritimes", - "abreviation": "Préfecture - Alpes-Maritimes", - "url": "http://www.alpes-maritimes.gouv.fr", - "telephone": "04 93 72 20 00", - "adresse1": "CADAM, 147, route de Grenoble", - "adresse2": "Services de l'État dans les Alpes-Maritimes, Préfecture, CADAM, 147, route de Grenoble", - "code_postal": "06000", - "commune": "Nice", - "departement_id": "06" - }, - { - "id": "pre-07186-01", - "type_id": "pre", - "nom": "Préfecture - Ardèche", - "abreviation": "Préfecture - Ardèche", - "url": "http://www.ardeche.gouv.fr", - "email": "pref-courrier@ardeche.gouv.fr", - "telephone": "04 75 66 50 00", - "adresse1": "4, boulevard de Vernon", - "code_postal": "07000", - "commune": "Privas", - "departement_id": "07" - }, - { - "id": "pre-08105-01", - "type_id": "pre", - "nom": "Préfecture - Ardennes", - "abreviation": "Préfecture - Ardennes", - "url": "http://www.ardennes.gouv.fr", - "email": "prefecture@ardennes.gouv.fr", - "telephone": "03 24 59 66 00", - "adresse1": "1, place de la Préfecture, BP 60002", - "code_postal": "08005", - "commune": "Charleville-Mézières Cedex", - "cedex": "Cedex", - "departement_id": "08" - }, - { - "id": "pre-09122-01", - "type_id": "pre", - "nom": "Préfecture - Ariège", - "abreviation": "Préfecture - Ariège", - "url": "http://www.ariege.gouv.fr", - "email": "prefecture@ariege.gouv.fr", - "telephone": "05 61 02 10 00", - "adresse1": "2, rue de la Préfecture - Préfet Claude Erignac, BP 4087", - "code_postal": "09007", - "commune": "Foix Cedex", - "cedex": "Cedex", - "departement_id": "09" - }, - { - "id": "pre-10387-01", - "type_id": "pre", - "nom": "Préfecture - Aube", - "abreviation": "Préfecture - Aube", - "url": "http://www.aube.gouv.fr", - "email": "prefecture@aube.gouv.fr", - "telephone": "03 25 42 35 00", - "adresse1": "CS 20372, 2, rue Pierre-Labonde", - "code_postal": "10025", - "commune": "Troyes Cedex", - "cedex": "Cedex", - "departement_id": "10" - }, - { - "id": "pre-11069-01", - "type_id": "pre", - "nom": "Préfecture - Aude", - "abreviation": "Préfecture - Aude", - "url": "http://www.aude.gouv.fr", - "email": "prefecture@aude.gouv.fr", - "telephone": "04 68 10 27 00", - "adresse1": "CS 20001, 52, rue Jean-Bringer", - "code_postal": "11836", - "commune": "Carcassonne Cedex 9", - "cedex": "Cedex 9", - "departement_id": "11" - }, - { - "id": "pre-12202-01", - "type_id": "pre", - "nom": "Préfecture - Aveyron", - "abreviation": "Préfecture - Aveyron", - "url": "http://www.aveyron.gouv.fr", - "email": "prefecture@aveyron.fr", - "telephone": "05 65 75 71 71", - "adresse1": "Centre administratif Foch, Place Foch", - "code_postal": "12000", - "commune": "Rodez", - "cedex": "Cedex", - "departement_id": "12" - }, - { - "id": "pre-13203-01", - "type_id": "pre", - "nom": "Préfecture - Bouches-du-Rhône", - "abreviation": "Préfecture - Bouches-du-Rhône", - "url": "http://www.bouches-du-rhone.gouv.fr", - "email": "contact@bouches-du-rhone.pref.gouv.fr", - "telephone": "04 84 35 40 00", - "adresse1": "Boulevard Paul-Peytral", - "code_postal": "13282", - "commune": "Marseille Cedex 20", - "cedex": "Cedex 20", - "departement_id": "13" - }, - { - "id": "pre-14118-01", - "type_id": "pre", - "nom": "Préfecture - Calvados", - "abreviation": "Préfecture - Calvados", - "url": "http://www.calvados.gouv.fr", - "email": "prefecture@calvados.gouv.fr", - "telephone": "02 31 30 64 00", - "adresse1": "Rue Daniel-Huet", - "code_postal": "14038", - "commune": "Caen Cedex 9", - "cedex": "Cedex 9", - "departement_id": "14" - }, - { - "id": "pre-15014-01", - "type_id": "pre", - "nom": "Préfecture - Cantal", - "abreviation": "Préfecture - Cantal", - "url": "http://www.cantal.gouv.fr", - "email": "courrier@cantal.pref.gouv.fr", - "telephone": "04 71 46 23 00", - "adresse1": "Cours Monthyon, BP 529", - "code_postal": "15005", - "commune": "Aurillac Cedex", - "cedex": "Cedex", - "departement_id": "15" - }, - { - "id": "pre-16015-01", - "type_id": "pre", - "nom": "Préfecture - Charente", - "abreviation": "Préfecture - Charente", - "url": "http://www.charente.gouv.fr", - "email": "communication@charente.gouv.fr", - "telephone": "05 45 97 61 00", - "adresse1": "7-9, rue de la Préfecture, CS 92301", - "code_postal": "16023", - "commune": "Angoulême Cedex", - "cedex": "Cedex", - "departement_id": "16" - }, - { - "id": "pre-17300-01", - "type_id": "pre", - "nom": "Préfecture - Charente-Maritime", - "abreviation": "Préfecture - Charente-Maritime", - "url": "http://www.charente-maritime.gouv.fr", - "email": "prefecture@charente-maritime.gouv.fr", - "telephone": "05 46 27 43 00", - "adresse1": "CS 70000, 38, rue Réaumur", - "code_postal": "17017", - "commune": "La Rochelle Cedex 1", - "cedex": "Cedex 1", - "departement_id": "17" - }, - { - "id": "pre-18033-01", - "type_id": "pre", - "nom": "Préfecture - Cher", - "abreviation": "Préfecture - Cher", - "url": "http://www.cher.gouv.fr", - "email": "prefecture@cher.gouv.fr", - "telephone": "02 48 67 18 18", - "adresse1": "Place Marcel-Plaisant, CS 60022", - "code_postal": "18020", - "commune": "Bourges Cedex", - "cedex": "Cedex", - "departement_id": "18" - }, - { - "id": "pre-19272-01", - "type_id": "pre", - "nom": "Préfecture - Corrèze", - "abreviation": "Préfecture - Corrèze", - "url": "http://www.correze.gouv.fr", - "email": "prefecture@correze.gouv.fr", - "telephone": "05 55 20 55 20", - "adresse1": "1, rue Souham, BP 250", - "code_postal": "19012", - "commune": "Tulle Cedex", - "cedex": "Cedex", - "departement_id": "19" - }, - { - "id": "pre-21231-01", - "type_id": "pre", - "nom": "Préfecture - Côte-d'Or", - "abreviation": "Préfecture - Côte-d'Or", - "url": "http://www.cote-dor.gouv.fr", - "telephone": "03 80 44 64 00", - "adresse1": "53, rue de la Préfecture", - "code_postal": "21041", - "commune": "Dijon Cedex", - "cedex": "Cedex", - "departement_id": "21" - }, - { - "id": "pre-22278-01", - "type_id": "pre", - "nom": "Préfecture - Côtes-d'Armor", - "abreviation": "Préfecture - Côtes-d'Armor", - "url": "http://www.cotes-darmor.gouv.fr", - "email": "prefecture@cotes-darmor.gouv.fr", - "telephone": "02 96 62 44 22", - "adresse1": "1, place du Général-de-Gaulle, BP 2370", - "code_postal": "22023", - "commune": "Saint-Brieuc Cedex 1", - "cedex": "Cedex 1", - "departement_id": "22" - }, - { - "id": "pre-23096-01", - "type_id": "pre", - "nom": "Préfecture - Creuse", - "abreviation": "Préfecture - Creuse", - "url": "http://www.creuse.gouv.fr", - "telephone": "05 55 51 59 00", - "adresse1": "BP 79, Place Louis-Lacrocq", - "code_postal": "23011", - "commune": "Guéret Cedex", - "cedex": "Cedex", - "departement_id": "23" - }, - { - "id": "pre-24322-01", - "type_id": "pre", - "nom": "Préfecture - Dordogne", - "abreviation": "Préfecture - Dordogne", - "url": "http://www.dordogne.gouv.fr", - "email": "prefecture@dordogne.gouv.fr", - "telephone": "05 53 02 24 24", - "adresse1": "2, rue Paul-Louis-Courier", - "adresse2": "Services de l'État - Préfecture de la Dordogne, Cité adminsitrative", - "code_postal": "24000", - "commune": "Périgueux", - "departement_id": "24" - }, - { - "id": "pre-25056-01", - "type_id": "pre", - "nom": "Préfecture - Doubs", - "abreviation": "Préfecture - Doubs", - "url": "http://www.doubs.gouv.fr", - "email": "pref-courrier@doubs.gouv.fr", - "telephone": "03 81 25 10 00", - "adresse1": "8 bis, rue Charles-Nodier", - "code_postal": "25035", - "commune": "Besançon Cedex", - "departement_id": "25" - }, - { - "id": "pre-26362-01", - "type_id": "pre", - "nom": "Préfecture - Drôme", - "abreviation": "Préfecture - Drôme", - "url": "http://www.drome.gouv.fr", - "email": "prefecture@drome.gouv.fr", - "telephone": "04 75 79 28 00", - "adresse1": "3, boulevard Vauban", - "code_postal": "26030", - "commune": "Valence Cedex 9", - "departement_id": "26" - }, - { - "id": "pre-27229-01", - "type_id": "pre", - "nom": "Préfecture - Eure", - "abreviation": "Préfecture - Eure", - "url": "http://www.seine-maritime.gouv.fr/Outils/Horaires-et-coordonnees/Prefecture-de-l-Eure", - "email": "courrier-web@eure.gouv.fr", - "telephone": "02 32 78 27 27", - "adresse1": "Boulevard Georges-Chauvin", - "code_postal": "27022", - "commune": "Evreux Cedex", - "departement_id": "27" - }, - { - "id": "pre-28085-01", - "type_id": "pre", - "nom": "Préfecture - Eure-et-Loir", - "abreviation": "Préfecture - Eure-et-Loir", - "url": "http://www.eure-et-loir.gouv.fr", - "telephone": "02 37 27 72 00", - "adresse1": "Place de la République, CS 80537", - "code_postal": "28019", - "commune": "Chartres Cedex", - "departement_id": "28" - }, - { - "id": "pre-29232-01", - "type_id": "pre", - "nom": "Préfecture - Finistère", - "abreviation": "Préfecture - Finistère", - "url": "http://www.finistere.gouv.fr", - "email": "prefecture@finistere.gouv.fr", - "telephone": "02 98 76 29 29", - "adresse1": "42, boulevard Dupleix", - "code_postal": "29320", - "commune": "Quimper Cedex", - "cedex": "Cedex", - "departement_id": "29" - }, - { - "id": "pre-2A004-01", - "type_id": "pre", - "nom": "Préfecture - Corse-du-Sud", - "abreviation": "Préfecture - Corse-du-Sud", - "url": "http://www.corse-du-sud.gouv.fr", - "email": "prefecture@corse-du-sud.gouv.fr", - "telephone": "04 95 11 12 13", - "adresse1": "Palais Lantivy, Cours Napoléon", - "code_postal": "20188", - "commune": "Ajaccio Cedex 9", - "cedex": "Cedex 9", - "departement_id": "2A" - }, - { - "id": "pre-2B033-01", - "type_id": "pre", - "nom": "Préfecture - Haute-Corse", - "abreviation": "Préfecture - Haute-Corse", - "url": "http://www.haute-corse.gouv.fr", - "email": "prefecture.haute-corse@haute-corse.pref.gouv.fr", - "telephone": "04 95 34 50 00", - "adresse1": "CS 60007, Rond-Point du Maréchal-Leclerc-de-Hautecloque", - "code_postal": "20401", - "commune": "Bastia Cedex 09", - "departement_id": "2B" - }, - { - "id": "pre-30189-01", - "type_id": "pre", - "nom": "Préfecture - Gard", - "abreviation": "Préfecture - Gard", - "url": "http://www.gard.gouv.fr", - "email": "prefecture@gard.gouv.fr", - "telephone": "0820 09 11 72", - "adresse1": "2, rue Guillemette, 19, avenue Feuchères (étrangers)", - "adresse2": "10, avenue Feuchères", - "code_postal": "30000", - "commune": "Nîmes", - "departement_id": "30" - }, - { - "id": "pre-31555-01", - "type_id": "pre", - "nom": "Préfecture - Haute-Garonne", - "abreviation": "Préfecture - Haute-Garonne", - "url": "http://www.haute-garonne.gouv.fr", - "telephone": "05 34 45 34 45", - "adresse1": "1 place Saint-Étienne", - "adresse2": "Place Saint-Étienne", - "code_postal": "31000", - "commune": "Toulouse", - "departement_id": "31" - }, - { - "id": "pre-32013-01", - "type_id": "pre", - "nom": "Préfecture - Gers", - "abreviation": "Préfecture - Gers", - "url": "http://www.gers.gouv.fr", - "email": "prefecture@gers.gouv.fr", - "telephone": "05 62 61 44 00", - "adresse1": "3, place du Préfet Claude-Erignac", - "code_postal": "32007", - "commune": "Auch Cedex", - "departement_id": "32" - }, - { - "id": "pre-33063-01", - "type_id": "pre", - "nom": "Préfecture - Gironde", - "abreviation": "Préfecture - Gironde", - "url": "http://www.gironde.gouv.fr", - "telephone": "05 56 90 60 60", - "adresse1": "Rue Claude-Bonnier", - "adresse2": "2, esplanade Charles-de-Gaulle, CS 41397", - "code_postal": "33000", - "commune": "Bordeaux", - "departement_id": "33" - }, - { - "id": "pre-34172-01", - "type_id": "pre", - "nom": "Préfecture - Hérault", - "abreviation": "Préfecture - Hérault", - "url": "http://www.herault.gouv.fr", - "telephone": "04 67 61 61 61", - "adresse1": "34, place des Martyrs-de-la-Résistance", - "code_postal": "34062", - "commune": "Montpellier Cedex 2", - "cedex": "Cedex 2", - "departement_id": "34" - }, - { - "id": "pre-35238-01", - "type_id": "pre", - "nom": "Préfecture - Ille-et-Vilaine", - "abreviation": "Préfecture - Ille-et-Vilaine", - "url": "https://www.ille-et-vilaine.gouv.fr", - "email": "prefecture@ille-et-vilaine.gouv.fr", - "telephone": "02 99 02 10 35", - "adresse1": "3, avenue de la Préfecture", - "code_postal": "35026", - "commune": "Rennes Cedex 9", - "departement_id": "35" - }, - { - "id": "pre-36044-01", - "type_id": "pre", - "nom": "Préfecture - Indre", - "abreviation": "Préfecture - Indre", - "url": "http://www.indre.gouv.fr", - "telephone": "02 54 29 50 00", - "adresse1": "Rue des Jeux marins", - "adresse2": "Place de la Victoire et des Alliés, CS 80583", - "code_postal": "36000", - "commune": "Châteauroux", - "departement_id": "36" - }, - { - "id": "pre-37261-01", - "type_id": "pre", - "nom": "Préfecture - Indre-et-Loire", - "abreviation": "Préfecture - Indre-et-Loire", - "url": "http://www.indre-et-loire.gouv.fr", - "email": "prefecture@indre-et-loire.gouv.fr", - "telephone": "+ 33 2 47 64 37 37", - "adresse1": "15, rue Bernard-Palissy", - "code_postal": "37925", - "commune": "Tours Cedex 9", - "cedex": "Cedex 9", - "departement_id": "37" - }, - { - "id": "pre-38185-01", - "type_id": "pre", - "nom": "Préfecture - Isère", - "abreviation": "Préfecture - Isère", - "url": "http://www.isere.gouv.fr", - "telephone": "04 76 60 34 00", - "adresse1": "CS 71046, Place de Verdun", - "code_postal": "38021", - "commune": "Grenoble Cedex 1", - "departement_id": "38" - }, - { - "id": "pre-39300-01", - "type_id": "pre", - "nom": "Préfecture - Jura", - "abreviation": "Préfecture - Jura", - "url": "http://www.jura.gouv.fr", - "email": "prefecture@jura.gouv.fr", - "telephone": "03 84 86 84 00", - "adresse1": "8, rue de la Préfecture", - "code_postal": "39030", - "commune": "Lons-le-Saunier Cedex", - "departement_id": "39" - }, - { - "id": "pre-40192-01", - "type_id": "pre", - "nom": "Préfecture - Landes", - "abreviation": "Préfecture - Landes", - "url": "http://www.landes.gouv.fr", - "email": "prefecture@landes.gouv.fr", - "telephone": "05 58 06 58 06", - "adresse1": "24-26, rue Victor-Hugo", - "code_postal": "40021", - "commune": "Mont-de-Marsan Cedex", - "departement_id": "40" - }, - { - "id": "pre-41018-01", - "type_id": "pre", - "nom": "Préfecture - Loir-et-Cher", - "abreviation": "Préfecture - Loir-et-Cher", - "url": "http://www.loir-et-cher.gouv.fr", - "telephone": "0810 02 41 41", - "adresse1": "BP 40299, 1, place de la République", - "code_postal": "41006", - "commune": "Blois Cedex", - "departement_id": "41" - }, - { - "id": "pre-42218-01", - "type_id": "pre", - "nom": "Préfecture - Loire", - "abreviation": "Préfecture - Loire", - "url": "http://www.loire.gouv.fr", - "email": "pref-loire@loire.pref.gouv.fr", - "telephone": "04 77 48 48 48", - "adresse1": "2, rue Charles-de-Gaulle", - "code_postal": "42022", - "commune": "Saint-Etienne Cedex 1", - "departement_id": "42" - }, - { - "id": "pre-43157-01", - "type_id": "pre", - "nom": "Préfecture - Haute-Loire", - "abreviation": "Préfecture - Haute-Loire", - "url": "http://www.haute-loire.gouv.fr", - "email": "prefecture@haute-loire.gouv.fr", - "telephone": "04 71 09 43 43", - "adresse1": "6, avenue du Général-de-Gaulle, CS 40321", - "code_postal": "43009", - "commune": "Le Puy-en-Velay Cedex", - "cedex": "Cedex", - "departement_id": "43" - }, - { - "id": "pre-44109-01", - "type_id": "pre", - "nom": "Préfecture - Loire-Atlantique", - "abreviation": "Préfecture - Loire-Atlantique", - "url": "http://www.loire-atlantique.gouv.fr", - "telephone": "02 40 41 20 20", - "adresse1": "6, quai Ceineray, BP 33515", - "code_postal": "44035", - "commune": "Nantes Cedex 1", - "departement_id": "44" - }, - { - "id": "pre-45234-01", - "type_id": "pre", - "nom": "Préfecture - Loiret", - "abreviation": "Préfecture - Loiret", - "url": "http://www.loiret.gouv.fr", - "telephone": "0821 80 30 45", - "adresse1": "181, rue de Bourgogne", - "code_postal": "45042", - "commune": "Orléans Cedex 1", - "departement_id": "45" - }, - { - "id": "pre-46042-01", - "type_id": "pre", - "nom": "Préfecture - Lot", - "abreviation": "Préfecture - Lot", - "url": "http://www.lot.gouv.fr", - "email": "prefecture@lot.gouv.fr", - "telephone": "05 65 23 10 00", - "adresse1": "Cité Bessières", - "code_postal": "46009", - "commune": "Cahors Cedex 9", - "departement_id": "46" - }, - { - "id": "pre-47001-01", - "type_id": "pre", - "nom": "Préfecture - Lot-et-Garonne", - "abreviation": "Préfecture - Lot-et-Garonne", - "url": "http://www.lot-et-garonne.gouv.fr", - "telephone": "05 53 77 60 47", - "adresse1": "Place de Verdun", - "code_postal": "47920", - "commune": "Agen Cedex 9", - "departement_id": "47" - }, - { - "id": "pre-48095-01", - "type_id": "pre", - "nom": "Préfecture - Lozère", - "abreviation": "Préfecture - Lozère", - "url": "http://www.lozere.gouv.fr", - "email": "prefecture@lozere.gouv.fr", - "telephone": "04 66 49 60 00", - "adresse1": "Rue du Faubourg-Montbel", - "adresse2": "BP 130", - "code_postal": "48000", - "commune": "Mende", - "departement_id": "48" - }, - { - "id": "pre-49007-01", - "type_id": "pre", - "nom": "Préfecture - Maine-et-Loire", - "abreviation": "Préfecture - Maine-et-Loire", - "url": "http://www.maine-et-loire.gouv.fr", - "email": "modernisation@maine-et-loire.pref.gouv.fr", - "telephone": "02 41 81 81 81", - "adresse1": "Place Michel-Debré", - "code_postal": "49934", - "commune": "Angers Cedex 9", - "departement_id": "49" - }, - { - "id": "pre-50502-01", - "type_id": "pre", - "nom": "Préfecture - Manche", - "abreviation": "Préfecture - Manche", - "url": "http://www.manche.gouv.fr", - "email": "prefecture@manche.gouv.fr", - "telephone": "02 33 75 49 50", - "adresse1": "Place de la Préfecture, BP 70522", - "code_postal": "50002", - "commune": "Saint-Lô Cedex", - "departement_id": "50" - }, - { - "id": "pre-51108-01", - "type_id": "pre", - "nom": "Préfecture - Marne", - "abreviation": "Préfecture - Marne", - "url": "http://www.marne.gouv.fr", - "email": "contact@marne.gouv.fr", - "telephone": "03 26 26 10 10", - "adresse1": "38, rue Carnot", - "code_postal": "51036", - "commune": "Châlons-en-Champagne Cedex", - "departement_id": "51" - }, - { - "id": "pre-52121-01", - "type_id": "pre", - "nom": "Préfecture - Haute-Marne", - "abreviation": "Préfecture - Haute-Marne", - "url": "http://www.haute-marne.gouv.fr", - "email": "prefecture@haute-marne.gouv.fr", - "telephone": "03 25 30 52 52", - "adresse1": "89, rue de la Victoire-de-la-Marne", - "code_postal": "52011", - "commune": "Chaumont Cedex", - "departement_id": "52" - }, - { - "id": "pre-53130-01", - "type_id": "pre", - "nom": "Préfecture - Mayenne", - "abreviation": "Préfecture - Mayenne", - "url": "http://www.mayenne.gouv.fr", - "email": "pref-communication@mayenne.gouv.fr", - "telephone": "02 43 01 50 00", - "adresse1": "46, rue Mazagran, CS 91507", - "code_postal": "53015", - "commune": "Laval Cedex", - "departement_id": "53" - }, - { - "id": "pre-54395-01", - "type_id": "pre", - "nom": "Préfecture - Meurthe-et-Moselle", - "abreviation": "Préfecture - Meurthe-et-Moselle", - "url": "http://www.meurthe-et-moselle.gouv.fr", - "email": "pref-informations@meurthe-et-moselle.gouv.fr", - "telephone": "03 83 34 26 26", - "adresse1": "6, rue Sainte-Catherine", - "adresse2": "CS 60031, 1, rue du Préfet-Claude-Érignac", - "code_postal": "54000", - "commune": "Nancy", - "departement_id": "54" - }, - { - "id": "pre-55029-01", - "type_id": "pre", - "nom": "Préfecture - Meuse", - "abreviation": "Préfecture - Meuse", - "url": "http://www.meuse.gouv.fr", - "telephone": "03 29 77 55 55", - "adresse1": "40, rue du Bourg, CS 30512", - "code_postal": "55012", - "commune": "Bar-le-Duc Cedex", - "cedex": "Cedex", - "departement_id": "55" - }, - { - "id": "pre-56260-01", - "type_id": "pre", - "nom": "Préfecture - Morbihan", - "abreviation": "Préfecture - Morbihan", - "url": "http://www.morbihan.gouv.fr", - "telephone": "02 97 54 84 00", - "adresse1": "24, place de la République", - "adresse2": "Préfecture du Morbihan, BP 501", - "code_postal": "56000", - "commune": "Vannes", - "departement_id": "56" - }, - { - "id": "pre-57463-01", - "type_id": "pre", - "nom": "Préfecture - Moselle", - "abreviation": "Préfecture - Moselle", - "telephone": "03 87 34 87 34", - "adresse1": "9, place de la Préfecture, BP 71014", - "code_postal": "57034", - "commune": "Metz Cedex 01", - "cedex": "Cedex 01", - "departement_id": "57" - }, - { - "id": "pre-58194-01", - "type_id": "pre", - "nom": "Préfecture - Nièvre", - "abreviation": "Préfecture - Nièvre", - "url": "http://www.nievre.gouv.fr", - "email": "courrier@nievre.pref.gouv.fr", - "telephone": "03 86 60 70 80", - "adresse1": "40, rue de la Préfecture", - "code_postal": "58026", - "commune": "Nevers Cedex", - "cedex": "Cedex", - "departement_id": "58" - }, - { - "id": "pre-59350-01", - "type_id": "pre", - "nom": "Préfecture - Nord", - "abreviation": "Préfecture - Nord", - "url": "http://www.nord.gouv.fr", - "telephone": "03 20 30 59 59", - "adresse1": "CS 20003, 12, rue Jean-Sans-Peur", - "code_postal": "59039", - "commune": "Lille Cedex", - "cedex": "Cedex", - "departement_id": "59" - }, - { - "id": "pre-60057-01", - "type_id": "pre", - "nom": "Préfecture - Oise", - "abreviation": "Préfecture - Oise", - "url": "http://www.oise.gouv.fr", - "telephone": "03 44 06 12 60", - "adresse1": "1, place de la Préfecture", - "code_postal": "60022", - "commune": "Beauvais Cedex", - "cedex": "Cedex", - "departement_id": "60" - }, - { - "id": "pre-61001-01", - "type_id": "pre", - "nom": "Préfecture - Orne", - "abreviation": "Préfecture - Orne", - "url": "http://www.orne.gouv.fr", - "email": "pref-communication@orne.gouv.fr", - "telephone": "02 33 80 61 61", - "adresse1": "BP 529, 39, rue Saint-Blaise", - "code_postal": "61018", - "commune": "Alençon Cedex", - "cedex": "Cedex", - "departement_id": "61" - }, - { - "id": "pre-62041-01", - "type_id": "pre", - "nom": "Préfecture - Pas-de-Calais", - "abreviation": "Préfecture - Pas-de-Calais", - "url": "http://www.pas-de-calais.gouv.fr", - "telephone": "03 21 21 20 00", - "adresse1": "Rue Ferdinand-Buisson", - "code_postal": "62020", - "commune": "Arras Cedex 9", - "cedex": "Cedex 9", - "departement_id": "62" - }, - { - "id": "pre-63113-01", - "type_id": "pre", - "nom": "Préfecture - Puy-de-Dôme", - "abreviation": "Préfecture - Puy-de-Dôme", - "url": "http://www.puy-de-dome.gouv.fr", - "telephone": "04 73 98 63 63", - "adresse1": "1, rue d'Assas", - "code_postal": "63033", - "commune": "Clermont-Ferrand Cedex 1", - "cedex": "Cedex 1", - "departement_id": "63" - }, - { - "id": "pre-64445-01", - "type_id": "pre", - "nom": "Préfecture - Pyrénées-Atlantiques", - "abreviation": "Préfecture - Pyrénées-Atlantiques", - "url": "http://www.pyrenees-atlantiques.gouv.fr", - "email": "prefecture@pyrenees-atlantiques.gouv.fr", - "telephone": "05 59 98 24 24", - "adresse1": "2, rue du Maréchal-Joffre", - "code_postal": "64021", - "commune": "Pau Cedex", - "cedex": "Cedex", - "departement_id": "64" - }, - { - "id": "pre-65440-01", - "type_id": "pre", - "nom": "Préfecture - Hautes-Pyrénées", - "abreviation": "Préfecture - Hautes-Pyrénées", - "url": "http://www.hautes-pyrenees.gouv.fr", - "email": "prefecture@hautes-pyrenees.gouv.fr", - "telephone": "05 62 56 65 65", - "adresse1": "CS 61350, Place Charles-de-Gaulle", - "code_postal": "65013", - "commune": "Tarbes Cedex 9", - "departement_id": "65" - }, - { - "id": "pre-66136-01", - "type_id": "pre", - "nom": "Préfecture - Pyrénées-Orientales", - "abreviation": "Préfecture - Pyrénées-Orientales", - "url": "http://www.pyrenees-orientales.gouv.fr", - "telephone": "04 68 51 66 66", - "adresse1": "24, quai Sadi-Carnot, BP 951", - "code_postal": "66951", - "commune": "Perpignan Cedex", - "cedex": "Cedex", - "departement_id": "66" - }, - { - "id": "pre-67482-01", - "type_id": "pre", - "nom": "Préfecture - Bas-Rhin", - "abreviation": "Préfecture - Bas-Rhin", - "url": "http://www.bas-rhin.gouv.fr", - "telephone": "03 88 21 67 68", - "adresse1": "5 place de la République, BP 1047", - "code_postal": "67073", - "commune": "Strasbourg Cedex", - "cedex": "Cedex", - "departement_id": "67" - }, - { - "id": "pre-68066-01", - "type_id": "pre", - "nom": "Préfecture - Haut-Rhin", - "abreviation": "Préfecture - Haut-Rhin", - "url": "http://www.haut-rhin.gouv.fr", - "email": "pref-courrier@haut-rhin.gouv.fr", - "telephone": "03 89 29 20 00", - "adresse1": "11, avenue de la République", - "adresse2": "7, rue Bruat, BP 10489", - "code_postal": "68000", - "commune": "Colmar", - "departement_id": "68" - }, - { - "id": "pre-69383-01", - "type_id": "pre", - "nom": "Préfecture - Rhône", - "abreviation": "Préfecture - Rhône", - "url": "http://www.rhone.gouv.fr", - "telephone": "0821 80 30 69", - "adresse1": "97, rue Molière", - "adresse2": "106, rue Pierre-Corneille", - "code_postal": "69003", - "commune": "Lyon", - "departement_id": "69" - }, - { - "id": "pre-70550-01", - "type_id": "pre", - "nom": "Préfecture - Haute-Saône", - "abreviation": "Préfecture - Haute-Saône", - "url": "http://www.haute-saone.gouv.fr", - "email": "prefecture@haute-saone.pref.gouv.fr", - "telephone": "03 84 77 70 00", - "adresse1": "1, rue de la Préfecture, BP 429", - "code_postal": "70013", - "commune": "Vesoul Cedex", - "departement_id": "70" - }, - { - "id": "pre-71270-01", - "type_id": "pre", - "nom": "Préfecture - Saône-et-Loire", - "abreviation": "Préfecture - Saône-et-Loire", - "url": "http://www.saone-et-loire.gouv.fr/prefecture-et-sous-prefectures-r1071.html", - "telephone": "03 85 21 81 00", - "adresse1": "196, rue de Strasbourg", - "code_postal": "71021", - "commune": "Mâcon Cedex 9", - "cedex": "Cedex 9", - "departement_id": "71" - }, - { - "id": "pre-72181-01", - "type_id": "pre", - "nom": "Préfecture - Sarthe", - "abreviation": "Préfecture - Sarthe", - "url": "http://www.sarthe.gouv.fr", - "email": "pref-mail@sarthe.gouv.fr", - "telephone": "02 43 39 72 72", - "adresse1": "Place Aristide-Briand", - "code_postal": "72041", - "commune": "Le Mans Cedex 9", - "cedex": "Cedex 9", - "departement_id": "72" - }, - { - "id": "pre-73065-01", - "type_id": "pre", - "nom": "Préfecture - Savoie", - "abreviation": "Préfecture - Savoie", - "url": "http://www.savoie.gouv.fr", - "email": "prefecture@savoie.gouv.fr", - "telephone": "04 79 75 50 50", - "adresse1": "Château des Ducs de Savoie, BP 1801", - "code_postal": "73018", - "commune": "Chambéry Cedex", - "cedex": "Cedex", - "departement_id": "73" - }, - { - "id": "pre-74010-01", - "type_id": "pre", - "nom": "Préfecture - Haute-Savoie", - "abreviation": "Préfecture - Haute-Savoie", - "url": "http://www.haute-savoie.gouv.fr", - "email": "prefecture@haute-savoie.gouv.fr", - "telephone": "04 50 33 60 00", - "adresse1": "30, rue du 30e-Régiment-d'Infanterie, BP 2332", - "code_postal": "74034", - "commune": "Annecy Cedex", - "cedex": "Cedex", - "departement_id": "74" - }, - { - "id": "pre-75104-01", - "type_id": "pre", - "nom": "Préfecture de police de Paris", - "abreviation": "Préfecture - Île-de-France", - "url": "http://www.prefecturedepolice.interieur.gouv.fr", - "telephone": "3430", - "adresse1": "1 bis rue de Lutèce", - "code_postal": "75004", - "commune": "Paris", - "departement_id": "75" - }, - { - "id": "pre-76540-01", - "type_id": "pre", - "nom": "Préfecture - Seine-Maritime", - "abreviation": "Préfecture - Seine-Maritime", - "url": "http://www.seine-maritime.gouv.fr", - "telephone": "02 32 76 50 00", - "adresse1": "7, place de la Madeleine", - "code_postal": "76036", - "commune": "Rouen Cedex", - "cedex": "Cedex", - "departement_id": "76" - }, - { - "id": "pre-77288-01", - "type_id": "pre", - "nom": "Préfecture - Seine-et-Marne", - "abreviation": "Préfecture - Seine-et-Marne", - "url": "http://www.seine-et-marne.gouv.fr", - "telephone": "01 64 71 76 77", - "adresse1": "12 rue des Saints-Pères", - "code_postal": "77010", - "commune": "Melun Cedex", - "cedex": "Cedex", - "departement_id": "77" - }, - { - "id": "pre-78646-01", - "type_id": "pre", - "nom": "Préfecture - Yvelines", - "abreviation": "Préfecture - Yvelines", - "url": "http://www.yvelines.gouv.fr", - "email": "pref-communication78@yvelines.gouv.fr", - "telephone": "01 39 49 78 00", - "adresse1": "1, rue Jean-Houdon", - "code_postal": "78000", - "commune": "Versailles", - "departement_id": "78" - }, - { - "id": "pre-79191-01", - "type_id": "pre", - "nom": "Préfecture - Deux-Sèvres", - "abreviation": "Préfecture - Deux-Sèvres", - "url": "http://www.deux-sevres.gouv.fr", - "email": "courrier@deux-sevres.pref.gouv.fr", - "telephone": "05 49 08 68 68", - "adresse1": "4, rue Duguesclin, BP 70000", - "code_postal": "79099", - "commune": "Niort Cedex 9", - "cedex": "Cedex 9", - "departement_id": "79" - }, - { - "id": "pre-80021-01", - "type_id": "pre", - "nom": "Préfecture - Somme", - "abreviation": "Préfecture - Somme", - "url": "http://www.somme.gouv.fr", - "email": "pref-courrier@somme.gouv.fr", - "telephone": "0821 80 30 80", - "adresse1": "51, rue de la République", - "code_postal": "80020", - "commune": "Amiens Cedex 9", - "cedex": "Cedex 9", - "departement_id": "80" - }, - { - "id": "pre-81004-01", - "type_id": "pre", - "nom": "Préfecture - Tarn", - "abreviation": "Préfecture - Tarn", - "url": "http://www.tarn.gouv.fr", - "email": "courrier@tarn.pref.gouv.fr", - "telephone": "05 63 45 61 61", - "adresse1": "Place de la Préfecture", - "code_postal": "81013", - "commune": "Albi Cedex 9", - "cedex": "Cedex 9", - "departement_id": "81" - }, - { - "id": "pre-82121-01", - "type_id": "pre", - "nom": "Préfecture - Tarn-et-Garonne", - "abreviation": "Préfecture - Tarn-et-Garonne", - "url": "http://www.tarn-et-garonne.gouv.fr", - "telephone": "05 63 22 82 00", - "adresse1": "2, allée de l'Empereur, BP 779", - "code_postal": "82013", - "commune": "Montauban Cedex", - "cedex": "Cedex", - "departement_id": "82" - }, - { - "id": "pre-83137-01", - "type_id": "pre", - "nom": "Préfecture - Var", - "abreviation": "Préfecture - Var", - "url": "http://www.var.gouv.fr", - "telephone": "04 94 18 83 83", - "adresse1": "CS 31209, Boulevard du 112e Régiment-d'Infanterie", - "code_postal": "83070", - "commune": "Toulon Cedex", - "cedex": "Cedex", - "departement_id": "83" - }, - { - "id": "pre-84007-01", - "type_id": "pre", - "nom": "Préfecture - Vaucluse", - "abreviation": "Préfecture - Vaucluse", - "url": "http://www.vaucluse.gouv.fr", - "email": "pref-contact@vaucluse.gouv.fr", - "telephone": "04 88 17 84 84", - "adresse1": "2, avenue de la Folie", - "adresse2": "Services de l'Etat en Vaucluse Préfecture", - "code_postal": "84000", - "commune": "Avignon", - "departement_id": "84" - }, - { - "id": "pre-85191-01", - "type_id": "pre", - "nom": "Préfecture - Vendée", - "abreviation": "Préfecture - Vendée", - "url": "http://www.vendee.gouv.fr", - "email": "prefecture@vendee.gouv.fr", - "telephone": "02 51 36 70 85", - "adresse1": "29, rue Delille", - "code_postal": "85922", - "commune": "La Roche-sur-Yon Cedex 9", - "cedex": "Cedex 9", - "departement_id": "85" - }, - { - "id": "pre-86194-01", - "type_id": "pre", - "nom": "Préfecture - Vienne", - "abreviation": "Préfecture - Vienne", - "url": "http://www.vienne.gouv.fr", - "email": "pref-courrier@vienne.gouv.fr", - "telephone": "05 49 55 70 00", - "adresse1": "BP 589, 7, place Aristide-Briand", - "code_postal": "86021", - "commune": "Poitiers Cedex", - "cedex": "Cedex", - "departement_id": "86" - }, - { - "id": "pre-87085-01", - "type_id": "pre", - "nom": "Préfecture - Haute-Vienne", - "abreviation": "Préfecture - Haute-Vienne", - "url": "http://www.haute-vienne.gouv.fr", - "telephone": "05 55 44 18 00", - "adresse1": "12 rue des Combes", - "code_postal": "87000", - "commune": "Limoges", - "departement_id": "87" - }, - { - "id": "pre-88160-01", - "type_id": "pre", - "nom": "Préfecture - Vosges", - "abreviation": "Préfecture - Vosges", - "url": "http://www.vosges.gouv.fr", - "email": "prefecture@vosges.gouv.fr", - "telephone": "03 29 69 88 88", - "adresse1": "1, place Foch", - "code_postal": "88026", - "commune": "Epinal Cedex", - "cedex": "Cedex", - "departement_id": "88" - }, - { - "id": "pre-89024-01", - "type_id": "pre", - "nom": "Préfecture - Yonne", - "abreviation": "Préfecture - Yonne", - "url": "http://www.yonne.gouv.fr", - "email": "prefecture@yonne.gouv.fr", - "telephone": "03 86 72 79 89", - "adresse1": "Place de la Préfecture", - "code_postal": "89016", - "commune": "Auxerre Cedex", - "cedex": "Cedex", - "departement_id": "89" - }, - { - "id": "pre-90010-01", - "type_id": "pre", - "nom": "Préfecture - Territoire de Belfort", - "abreviation": "Préfecture - Territoire de Belfort", - "url": "http://www.territoire-belfort.gouv.fr", - "email": "courrier90@territoire-de-belfort.pref.gouv.fr", - "telephone": "03 84 57 00 07", - "adresse1": "Place de la République", - "code_postal": "90020", - "commune": "Belfort Cedex", - "cedex": "Cedex", - "departement_id": "90" - }, - { - "id": "pre-91228-01", - "type_id": "pre", - "nom": "Préfecture - Essonne", - "abreviation": "Préfecture - Essonne", - "url": "http://www.essonne.gouv.fr", - "email": "prefecture@essonne.gouv.fr", - "telephone": "01 69 91 91 91", - "adresse1": "Boulevard de France", - "code_postal": "91010", - "commune": "Évry Courcouronnes cedex", - "departement_id": "91" - }, - { - "id": "pre-92050-01", - "type_id": "pre", - "nom": "Préfecture - Hauts-de-Seine", - "abreviation": "Préfecture - Hauts-de-Seine", - "url": "http://www.hauts-de-seine.gouv.fr", - "email": "prefecture@hauts-de-seine.gouv.fr", - "telephone": "01 40 97 20 00", - "adresse1": "167-177, avenue Joliot-Curie", - "code_postal": "92013", - "commune": "Nanterre Cedex", - "departement_id": "92" - }, - { - "id": "pre-93008-01", - "type_id": "pre", - "nom": "Préfecture - Seine-Saint-Denis", - "abreviation": "Préfecture - Seine-Saint-Denis", - "url": "http://www.seine-saint-denis.gouv.fr", - "email": "prefecture@seine-saint-denis.gouv.fr", - "telephone": "01 41 60 60 60", - "adresse1": "1, esplanade Jean-Moulin", - "code_postal": "93007", - "commune": "Bobigny Cedex", - "cedex": "Cedex", - "departement_id": "93" - }, - { - "id": "pre-94028-01", - "type_id": "pre", - "nom": "Préfecture - Val-de-Marne", - "abreviation": "Préfecture - Val-de-Marne", - "url": "http://www.val-de-marne.gouv.fr", - "email": "prefecture@val-de-marne.gouv.fr", - "telephone": "01 49 56 60 00", - "adresse1": "21-29, avenue du Général-de-Gaulle", - "code_postal": "94038", - "commune": "Créteil Cedex", - "cedex": "Cedex", - "departement_id": "94" - }, - { - "id": "pre-95127-01", - "type_id": "pre", - "nom": "Préfecture - Val-d'Oise", - "abreviation": "Préfecture - Val-d'Oise", - "url": "http://www.val-doise.gouv.fr", - "email": "prefecture@val-doise.gouv.fr", - "telephone": "01 34 20 95 95", - "adresse1": "CS 20105, 5, avenue Bernard-Hirsch", - "code_postal": "95010", - "commune": "Cergy-Pontoise Cedex", - "cedex": "Cedex", - "departement_id": "95" - }, - { - "id": "pre-97105-01", - "type_id": "pre", - "nom": "Préfecture - Guadeloupe", - "abreviation": "Préfecture - Guadeloupe", - "url": "http://www.guadeloupe.pref.gouv.fr", - "telephone": "+590 590 99 39 00", - "adresse1": "Avenue Paul-Lacavé", - "code_postal": "97109", - "commune": "Basse-Terre Cedex", - "departement_id": "971" - }, - { - "id": "pre-97209-01", - "type_id": "pre", - "nom": "Préfecture - Martinique", - "abreviation": "Préfecture - Martinique", - "url": "http://www.martinique.pref.gouv.fr", - "email": "contact.prefecture@martinique.pref.gouv.fr", - "telephone": "+596 596 39 36 00", - "adresse1": "82, rue Victor-Sévère", - "code_postal": "97262", - "commune": "Fort-de-France Cedex", - "departement_id": "972" - }, - { - "id": "pre-97302-01", - "type_id": "pre", - "nom": "Préfecture - Guyane", - "abreviation": "Préfecture - Guyane", - "url": "http://www.guyane.pref.gouv.fr", - "email": "courrier@guyane.pref.gouv.fr", - "telephone": "+594 594 39 45 00", - "adresse1": "BP 7008, Rue Fiedmond", - "code_postal": "97307", - "commune": "Cayenne Cedex", - "departement_id": "973" - }, - { - "id": "pre-97411-01", - "type_id": "pre", - "nom": "Préfecture - La Réunion", - "abreviation": "Préfecture - Réunion", - "url": "http://www.reunion.gouv.fr", - "telephone": "+262 262 40 77 77", - "adresse1": "1, rue de la Messagerie, CS 51079", - "code_postal": "97404", - "commune": "Saint-Denis Cedex", - "cedex": "Cedex", - "departement_id": "974" - }, - { - "id": "pre-97611-01", - "type_id": "pre", - "nom": "Préfecture - Mayotte", - "abreviation": "Préfecture - Mayotte", - "url": "http://www.mayotte.pref.gouv.fr/", - "telephone": "+262 269 63 50 00", - "adresse1": "BP 676, Kawéni, Avenue de la Préfecture", - "code_postal": "97600", - "commune": "Mamoudzou", - "departement_id": "976" - } -] \ No newline at end of file diff --git a/packages/api/src/api/_format/administrations.ts b/packages/api/src/api/_format/administrations.ts index d70ff616e..c52b13728 100644 --- a/packages/api/src/api/_format/administrations.ts +++ b/packages/api/src/api/_format/administrations.ts @@ -2,11 +2,16 @@ import { IAdministration } from '../../types' import { titresFormat } from './titres' import { utilisateurFormat } from './utilisateurs' +import { + Administrations, + ADMINISTRATION_TYPES +} from 'camino-common/src/administrations' +import { Regions } from 'camino-common/src/region' +import { Departements } from 'camino-common/src/departement' /** * Formate une administration en fonction du profil de l'utilisateur * - * @param user - Utilisateur * @param administration - Administration à formater * @returns Une administration formatée * @@ -23,6 +28,22 @@ const administrationFormat = (administration: IAdministration) => { administration.utilisateurs = administration.utilisateurs?.map(utilisateurFormat) + const adminis = Administrations[administration.id] + administration.type = ADMINISTRATION_TYPES[adminis.typeId] + + for (const key of Object.keys(adminis)) { + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + administration[key] = adminis[key] + } + + if (adminis.departementId) { + administration.departement = Departements[adminis.departementId] + } + if (adminis.regionId) { + administration.region = Regions[adminis.regionId] + } + return administration } diff --git a/packages/api/src/api/_format/titres.ts b/packages/api/src/api/_format/titres.ts index eb3a0ac38..9192b8709 100644 --- a/packages/api/src/api/_format/titres.ts +++ b/packages/api/src/api/_format/titres.ts @@ -175,12 +175,12 @@ const titreFormat = (t: ITitre, fields: IFields = titreFormatFields) => { ...(t.administrationsLocales || []) ]) as IAdministration[] - t.administrations = administrations.sort( + t.administrations = administrations.map(administrationFormat) + + t.administrations = t.administrations.sort( (a, b) => a.type!.ordre - b.type!.ordre ) - t.administrations = t.administrations.map(administrationFormat) - delete t.administrationsGestionnaires delete t.administrationsLocales } else { diff --git a/packages/api/src/api/_format/utilisateurs.ts b/packages/api/src/api/_format/utilisateurs.ts index ff09a7d83..e05ed8469 100644 --- a/packages/api/src/api/_format/utilisateurs.ts +++ b/packages/api/src/api/_format/utilisateurs.ts @@ -1,7 +1,13 @@ import { IUtilisateur } from '../../types' +import { administrationFormat } from './administrations' const utilisateurFormat = (utilisateur: IUtilisateur) => { - // TODO: devrait formater les entreprises ou administrations de l'utilisateur + // TODO: devrait formater les entreprises de l'utilisateur + + if (utilisateur.administrations) { + utilisateur.administrations = + utilisateur.administrations.map(administrationFormat) + } return utilisateur } diff --git a/packages/api/src/api/graphql/resolvers.ts b/packages/api/src/api/graphql/resolvers.ts index 4be38e16b..9b127d8e4 100644 --- a/packages/api/src/api/graphql/resolvers.ts +++ b/packages/api/src/api/graphql/resolvers.ts @@ -82,7 +82,6 @@ import { uniteModifier, version, administrationsTypes, - administrationTypeModifier, regions, departements, permissionModifier, @@ -166,7 +165,6 @@ import { import { administration, administrations, - administrationModifier, administrationTitreTypeModifier, administrationTitreTypeTitreStatutModifier, administrationTitreTypeEtapeTypeModifier, @@ -298,7 +296,6 @@ export default { entrepriseModifier, entrepriseTitreTypeModifier, entreprisesTitresCreation, - administrationModifier, administrationTitreTypeModifier, administrationTitreTypeTitreStatutModifier, administrationTitreTypeEtapeTypeModifier, @@ -315,7 +312,6 @@ export default { etapeStatutModifier, deviseModifier, uniteModifier, - administrationTypeModifier, permissionModifier, documentTypeCreer, documentTypeModifier, diff --git a/packages/api/src/api/graphql/resolvers/administrations.ts b/packages/api/src/api/graphql/resolvers/administrations.ts index 55e7b0d21..59f7ac0a0 100644 --- a/packages/api/src/api/graphql/resolvers/administrations.ts +++ b/packages/api/src/api/graphql/resolvers/administrations.ts @@ -2,7 +2,6 @@ import { GraphQLResolveInfo } from 'graphql' import { IAdministrationActiviteType, - IAdministrationColonneId, IAdministrationTitreType, IAdministrationTitreTypeEtapeType, IAdministrationTitreTypeTitreStatut, @@ -14,8 +13,6 @@ import { debug } from '../../../config/index' import { administrationGet, administrationsGet, - administrationsCount, - administrationUpdate, administrationTitreTypeDelete, administrationTitreTypeUpsert, administrationTitreTypeTitreStatutUpsert, @@ -63,21 +60,7 @@ const administration = async ( } const administrations = async ( - { - page, - intervalle, - ordre, - colonne, - noms, - typesIds - }: { - page?: number | null - intervalle?: number | null - ordre?: 'asc' | 'desc' | null - colonne?: IAdministrationColonneId | null - noms?: string | null - typesIds?: string[] | null - }, + _: unknown, context: IToken, info: GraphQLResolveInfo ) => { @@ -85,93 +68,11 @@ const administrations = async ( const user = await userGet(context.user?.id) const fields = fieldsBuild(info) - const [administrations, total] = await Promise.all([ - administrationsGet( - { page, intervalle, ordre, colonne, noms, typesIds }, - { fields: fields.elements }, - user - ), - administrationsCount( - { noms, typesIds }, - { fields: fields.elements }, - user - ) - ]) - - if (!administrations.length) return { elements: [], total: 0 } - - return { - elements: administrations.map(administrationFormat), - page, - intervalle, - ordre, - colonne, - total - } - } catch (e) { - if (debug) { - console.error(e) - } - - throw e - } -} - -const administrationModifier = async ( - { - administration - }: { - administration: { - id: string - typeId: string - nom: string - abreviation: string - service?: string - url?: string - email?: string - telephone?: string - adresse1?: string - adresse2?: string - codePostal?: string - commune?: string - cedex?: string - departementId?: string - regionId?: string - } - }, - context: IToken, - info: GraphQLResolveInfo -) => { - try { - const user = await userGet(context.user?.id) - - const administrationOld = await administrationGet( - administration.id, - { fields: {} }, - user - ) - - if (!administrationOld) throw new Error("l'administration n'existe pas") + const administrations = await administrationsGet({ fields }, user) - if (!administrationOld.modification) throw new Error('droits insuffisants') - - const errors = [] - - if (administration.email && !emailCheck(administration.email)) { - errors.push('adresse email invalide') - } - - if (errors.length) { - throw new Error(errors.join(', ')) - } - - await administrationUpdate(administration.id, administration) - - const administrationId = await administrationUpdateTask(administration.id) - - const fields = fieldsBuild(info) + if (!administrations.length) return [] - return await administrationGet(administrationId, { fields }, user) + return administrations.map(administrationFormat) } catch (e) { if (debug) { console.error(e) @@ -456,7 +357,6 @@ const administrationActiviteTypeEmailSupprimer = async ( export { administration, administrations, - administrationModifier, administrationTitreTypeModifier, administrationTitreTypeTitreStatutModifier, administrationTitreTypeEtapeTypeModifier, diff --git a/packages/api/src/api/graphql/resolvers/metas.ts b/packages/api/src/api/graphql/resolvers/metas.ts index a4a138987..e126f1770 100644 --- a/packages/api/src/api/graphql/resolvers/metas.ts +++ b/packages/api/src/api/graphql/resolvers/metas.ts @@ -1,6 +1,5 @@ import { GraphQLResolveInfo } from 'graphql' import { - IAdministrationType, IDemarcheStatut, IDemarcheType, IDevise, @@ -22,8 +21,6 @@ import { import { debug } from '../../../config/index' import { - administrationsTypesGet, - administrationTypeUpdate, demarchesStatutsGet, demarcheStatutUpdate, demarchesTypesGet, @@ -75,6 +72,7 @@ import { ordreUpdate } from './_ordre-update' import { demarcheDefinitionFind } from '../../../business/rules-demarches/definitions' import { userSuper } from '../../../database/user-super' import { titresEtapesHeritageContenuUpdate } from '../../../business/processes/titres-etapes-heritage-contenu-update' +import { sortedAdministrationTypes } from 'camino-common/src/administrations' const devises = async () => devisesGet() @@ -371,11 +369,9 @@ const version = () => process.env.APPLICATION_VERSION * * @returns un tableau de types d'administrations */ -const administrationsTypes = async () => { +const administrationsTypes = () => { try { - const administrationsTypes = await administrationsTypesGet() - - return administrationsTypes + return sortedAdministrationTypes } catch (e) { if (debug) { console.error(e) @@ -745,41 +741,6 @@ const uniteModifier = async ({ unite }: { unite: IUnite }, context: IToken) => { } } -const administrationTypeModifier = async ( - { administrationType }: { administrationType: IAdministrationType }, - context: IToken -) => { - try { - const user = await userGet(context.user?.id) - - if (!permissionCheck(user?.permissionId, ['super'])) { - throw new Error('droits insuffisants') - } - - if (administrationType.ordre) { - const administrationsTypes = await administrationsTypesGet() - - await ordreUpdate( - administrationType, - administrationsTypes, - administrationTypeUpdate - ) - } - - await administrationTypeUpdate(administrationType.id!, administrationType) - - const administrationsTypes = await administrationsTypesGet() - - return administrationsTypes - } catch (e) { - if (debug) { - console.error(e) - } - - throw e - } -} - const permissionModifier = async ( { permission }: { permission: IPermission }, context: IToken @@ -951,7 +912,6 @@ export { etapeStatutModifier, deviseModifier, uniteModifier, - administrationTypeModifier, permissionModifier, documentTypeCreer, documentTypeModifier, diff --git a/packages/api/src/api/graphql/schemas/administrations.graphql b/packages/api/src/api/graphql/schemas/administrations.graphql index b320bc87e..dea9b3f2c 100644 --- a/packages/api/src/api/graphql/schemas/administrations.graphql +++ b/packages/api/src/api/graphql/schemas/administrations.graphql @@ -6,15 +6,6 @@ # import * from 'metas-activites.graphql' # import * from 'territoires.graphql' -type Administrations { - elements: [Administration] - intervalle: Int - page: Int - colonne: String - ordre: String - total: Int -} - type Administration { id: ID! nom: String @@ -30,7 +21,6 @@ type Administration { commune: String cedex: String utilisateurs: [Utilisateur] - membre: Boolean emailsModification: Boolean emailsLecture: Boolean gestionnaireTitres: [Titre] @@ -40,33 +30,33 @@ type Administration { titresTypesEtapesTypes: [TitreTypeEtapeType] activitesTypes: [ActiviteType] activitesTypesEmails: [ActiviteTypeEmail] - departement: Departement - region: Region + departement: AdministrationDepartement + region: AdministrationRegion modification: Boolean } -type ActiviteTypeEmail { - id: ID - nom: String - email: String +"Département" +type AdministrationDepartement { + "Id du département composé de 2 ou 3 chiffres (code INSEE)" + id: ID! + + "Nom du département" + nom: String! } -input InputAdministration { +"Région" +type AdministrationRegion { + "Id de la région composé de 2 chiffres (code INSEE)" id: ID! - typeId: ID! + + "Nom de la région" nom: String! - abreviation: String! - service: String - url: String +} + +type ActiviteTypeEmail { + id: ID + nom: String email: String - telephone: String - adresse1: String - adresse2: String - codePostal: String - commune: String - cedex: String - departementId: ID - regionId: ID } input InputAdministrationTitreType { diff --git a/packages/api/src/api/graphql/schemas/index.graphql b/packages/api/src/api/graphql/schemas/index.graphql index 521d5b9e8..d266e937a 100644 --- a/packages/api/src/api/graphql/schemas/index.graphql +++ b/packages/api/src/api/graphql/schemas/index.graphql @@ -215,14 +215,7 @@ type Query { administration(id: ID!): Administration "Liste des administrations" - administrations( - intervalle: Int - page: Int - colonne: String - ordre: String - noms: String - typesIds: [ID] - ): Administrations + administrations: [Administration] "Statistiques" statistiquesGlobales: StatistiquesGlobales @@ -385,9 +378,6 @@ type Mutation { "Modifie une entreprise" entrepriseModifier(entreprise: InputEntrepriseModification!): Entreprise - "Modifie une administration" - administrationModifier(administration: InputAdministration!): Administration - administrationTitreTypeModifier( administrationTitreType: InputAdministrationTitreType! ): Administration @@ -442,10 +432,6 @@ type Mutation { uniteModifier(unite: InputUnite!): [Unite] - administrationTypeModifier( - administrationType: InputAdministrationType! - ): [AdministrationType] - permissionModifier(permission: InputPermission!): [Permission] documentTypeCreer(documentType: InputDocumentType!): [DocumentType] diff --git a/packages/api/src/api/graphql/schemas/metas.graphql b/packages/api/src/api/graphql/schemas/metas.graphql index 917cec045..4983fb537 100644 --- a/packages/api/src/api/graphql/schemas/metas.graphql +++ b/packages/api/src/api/graphql/schemas/metas.graphql @@ -435,12 +435,6 @@ input InputUnite { referenceUniteRatio: Float } -input InputAdministrationType { - id: ID! - nom: String - ordre: Int -} - input InputDocumentType { id: ID! nom: String diff --git a/packages/api/src/business/_logs-update.ts b/packages/api/src/business/_logs-update.ts index 534c428df..f3b5401af 100644 --- a/packages/api/src/business/_logs-update.ts +++ b/packages/api/src/business/_logs-update.ts @@ -2,7 +2,6 @@ import { Index, IArea, ITitreAdministrationLocale, - IAdministration, IEntrepriseEtablissement, IEntreprise } from '../types' @@ -44,7 +43,6 @@ const logsUpdate = ({ entreprisesUpdated, etablissementsUpdated, etablissementsDeleted, - administrationsUpdated, utilisateursUpdated }: { titresEtapesOrdreUpdated?: string[] @@ -83,7 +81,6 @@ const logsUpdate = ({ entreprisesUpdated?: IEntreprise[] etablissementsUpdated?: IEntrepriseEtablissement[] etablissementsDeleted?: string[] - administrationsUpdated?: IAdministration[] utilisateursUpdated?: string[] }) => { console.info() @@ -300,12 +297,6 @@ const logsUpdate = ({ ) } - if (administrationsUpdated?.length) { - console.info( - `mise à jour: ${administrationsUpdated.length} administration(s)` - ) - } - if (utilisateursUpdated?.length) { console.info( `mise à jour: ${utilisateursUpdated.length} utilisateurs(s) inscrits à la newsletter` diff --git a/packages/api/src/business/administration-update.ts b/packages/api/src/business/administration-update.ts index 6b7e125af..fdaa2b756 100644 --- a/packages/api/src/business/administration-update.ts +++ b/packages/api/src/business/administration-update.ts @@ -1,4 +1,3 @@ -import { administrationsUpdate } from './processes/administrations-update' import { titresAdministrationsGestionnairesUpdate } from './processes/titres-administrations-gestionnaires-update' import { titresEtapesAdministrationsLocalesUpdate } from './processes/titres-etapes-administrations-locales-update' import { logsUpdate } from './_logs-update' @@ -9,10 +8,6 @@ const administrationUpdate = async (administrationId: string) => { console.info('- - -') console.info(`mise à jour d'une administration : ${administrationId}`) - const administrationsUpdated = await administrationsUpdate([ - administrationId - ]) - const { titresAdministrationsGestionnairesCreated = [], titresAdministrationsGestionnairesDeleted = [] @@ -27,8 +22,7 @@ const administrationUpdate = async (administrationId: string) => { titresAdministrationsGestionnairesCreated, titresAdministrationsGestionnairesDeleted, titresEtapesAdministrationsLocalesCreated, - titresEtapesAdministrationsLocalesDeleted, - administrationsUpdated + titresEtapesAdministrationsLocalesDeleted }) return administrationId diff --git a/packages/api/src/business/monthly.ts b/packages/api/src/business/monthly.ts index 0956d89b7..e63ca295b 100644 --- a/packages/api/src/business/monthly.ts +++ b/packages/api/src/business/monthly.ts @@ -1,4 +1,3 @@ -import { administrationsUpdate } from './processes/administrations-update' import { entreprisesUpdate } from './processes/entreprises-update' import { titresEtapesAreasUpdate } from './processes/titres-etapes-areas-update' import { logsUpdate } from './_logs-update' @@ -9,18 +8,12 @@ const monthly = async () => { console.info('- - -') console.info('mise à jour mensuelle') - // 1. const { entreprisesUpdated = [], etablissementsUpdated = [], etablissementsDeleted = [] } = await entreprisesUpdate() - // 2. - // mise à jour des administrations grâce à l'API Administration - const administrationsUpdated = await administrationsUpdate() - - // 3. // mise à jour des forêts et des communes const { titresCommunes, titresForets, titresSDOMZones } = await titresEtapesAreasUpdate() @@ -44,7 +37,6 @@ const monthly = async () => { entreprisesUpdated, etablissementsUpdated, etablissementsDeleted, - administrationsUpdated, communesUpdated, titresEtapesCommunesUpdated, titresEtapesCommunesDeleted, diff --git a/packages/api/src/business/processes/__mocks__/administrations-update.ts b/packages/api/src/business/processes/__mocks__/administrations-update.ts deleted file mode 100644 index c185e7425..000000000 --- a/packages/api/src/business/processes/__mocks__/administrations-update.ts +++ /dev/null @@ -1,32 +0,0 @@ -import Administrations from '../../../database/models/administrations' - -const administrationApiTest = { id: 'test-ok' } as Administrations - -const administrationsDbCreees = [ - { id: 'toto', typeId: 'min' } -] as Administrations[] -const administrationsApiCreees = [] as Administrations[] - -const administrationsDbModifiees = [ - { id: 'toto', departementId: '49', typeId: 'pre' } -] as Administrations[] -const administrationsApiModifiees = [ - { id: 'papa', departementId: '49', typeId: 'pre' } -] as Administrations[] - -const administrationsDbExistantes = [ - { id: 'toto', departementId: '75', typeId: 'pre' } -] as Administrations[] -const administrationsApiExistantes = [ - { id: 'toto', departementId: '75', typeId: 'pre' } -] as Administrations[] - -export { - administrationApiTest, - administrationsDbCreees, - administrationsApiCreees, - administrationsDbModifiees, - administrationsApiModifiees, - administrationsDbExistantes, - administrationsApiExistantes -} diff --git a/packages/api/src/business/processes/administrations-update.test.ts b/packages/api/src/business/processes/administrations-update.test.ts deleted file mode 100644 index 160b0c20c..000000000 --- a/packages/api/src/business/processes/administrations-update.test.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { mocked } from 'jest-mock' - -import { administrationsUpdate } from './administrations-update' -import { - organismeDepartementGet, - organismesDepartementsGet -} from '../../tools/api-administrations/index' - -import { - administrationApiTest, - administrationsDbCreees, - administrationsApiCreees, - administrationsDbModifiees, - administrationsApiModifiees, - administrationsDbExistantes, - administrationsApiExistantes -} from './__mocks__/administrations-update' - -import { administrationsGet } from '../../database/queries/administrations' - -jest.mock('../../database/queries/administrations', () => ({ - __esModule: true, - administrationsUpsert: jest.fn(), - administrationsGet: jest.fn() -})) - -jest.mock('../../tools/api-administrations/index', () => ({ - __esModule: true, - organismeDepartementGet: jest.fn(), - organismesDepartementsGet: jest.fn() -})) - -const administrationsGetMock = mocked(administrationsGet, true) -const organismeDepartementGetMock = mocked(organismeDepartementGet, true) -const organismesDepartementsGetMock = mocked(organismesDepartementsGet, true) - -console.info = jest.fn() - -describe('administrations', () => { - test("ne crée pas les administrations qui n'ont pas de département", async () => { - administrationsGetMock.mockResolvedValue(administrationsDbCreees) - organismeDepartementGetMock.mockResolvedValue(administrationApiTest) - organismesDepartementsGetMock.mockResolvedValue(administrationsApiCreees) - - const administrationsUpdated = await administrationsUpdate() - - expect(administrationsUpdated.length).toEqual(0) - }) - - test('met à jour les administrations qui ont été modifiées', async () => { - administrationsGetMock.mockResolvedValue(administrationsDbModifiees) - organismeDepartementGetMock.mockResolvedValue(administrationApiTest) - organismesDepartementsGetMock.mockResolvedValue(administrationsApiModifiees) - - const administrationsUpdated = await administrationsUpdate() - - expect(administrationsUpdated.length).toEqual(1) - }) - - test('ne crée pas les administrations qui existent déjà', async () => { - administrationsGetMock.mockResolvedValue(administrationsDbExistantes) - organismeDepartementGetMock.mockResolvedValue(administrationApiTest) - organismesDepartementsGetMock.mockResolvedValue( - administrationsApiExistantes - ) - - const administrationsUpdated = await administrationsUpdate() - - expect(administrationsUpdated.length).toEqual(0) - }) - - test("ne met rien à jour si le test de connexion à l'API administration n'est pas concluant", async () => { - administrationsGetMock.mockResolvedValue(administrationsDbExistantes) - organismeDepartementGetMock.mockRejectedValue(new Error('api error')) - organismeDepartementGetMock.mockResolvedValue(null) - - const administrationsUpdated = await administrationsUpdate() - - expect(administrationsUpdated.length).toEqual(0) - }) -}) diff --git a/packages/api/src/business/processes/administrations-update.ts b/packages/api/src/business/processes/administrations-update.ts deleted file mode 100644 index 2a8499ad5..000000000 --- a/packages/api/src/business/processes/administrations-update.ts +++ /dev/null @@ -1,99 +0,0 @@ -import { IAdministration } from '../../types' - -import { - administrationsGet, - administrationsUpsert -} from '../../database/queries/administrations' -import { - organismeDepartementGet, - organismesDepartementsGet -} from '../../tools/api-administrations/index' - -import { objectsDiffer } from '../../tools/index' -import { userSuper } from '../../database/user-super' - -const administrationsUpdatedFind = ( - administrationsOld: IAdministration[], - administrationsNew: IAdministration[] -) => - administrationsNew.reduce((acc: IAdministration[], administrationNew) => { - const administrationOld = administrationsOld.find( - a => - a.departementId === administrationNew.departementId && - a.typeId === administrationNew.typeId - ) - - const updated = - !administrationOld || objectsDiffer(administrationNew, administrationOld) - - if (updated) { - acc.push(administrationNew) - } - - return acc - }, []) - -const apiAdministrationGetTest = async () => - organismeDepartementGet( - '01', - 'prefecture' - ) as unknown as IAdministration | null - -const apiAdministrationsGet = async (departementsIds: string[]) => { - const departementsIdsNoms = departementsIds.map(departementId => ({ - departementId, - nom: departementId === '75' ? 'paris_ppp' : 'prefecture' - })) - - return organismesDepartementsGet(departementsIdsNoms) -} - -const administrationsUpdate = async (administrationsIds?: string[]) => { - console.info() - console.info('administrations…') - const apiAdministrationsTest = await apiAdministrationGetTest() - if (!apiAdministrationsTest) return [] - - const administrationsOld = await administrationsGet( - { administrationsIds }, - {}, - userSuper - ) - - // mise à jour de l'administrations grâce à l'API Administration - const departementsIds = administrationsOld.reduce((acc, a) => { - if (a.departementId) { - acc.push(a.departementId) - } - - return acc - }, [] as string[]) - - if (!departementsIds.length) return [] - - const administrationsNew = await apiAdministrationsGet(departementsIds) - - // si aucune administration n'est retournée, - // on n'efface pas les administrations correspondantes de la base - // pour éviter de perdre des données en base - - const administrationsUpdated = administrationsUpdatedFind( - administrationsOld, - administrationsNew - ) - - if (administrationsUpdated.length) { - await administrationsUpsert(administrationsUpdated) - - const log = { - type: 'administrations (mise à jour) ->', - value: administrationsUpdated.map(a => a.id).join(', ') - } - - console.info(log.type, log.value) - } - - return administrationsUpdated -} - -export { administrationsUpdate } diff --git a/packages/api/src/business/processes/titres-administrations-gestionnaires-update.ts b/packages/api/src/business/processes/titres-administrations-gestionnaires-update.ts index 45cc233c1..bfebc122e 100644 --- a/packages/api/src/business/processes/titres-administrations-gestionnaires-update.ts +++ b/packages/api/src/business/processes/titres-administrations-gestionnaires-update.ts @@ -129,7 +129,7 @@ const titresAdministrationsGestionnairesUpdate = async ( userSuper ) - const administrations = await administrationsGet({}, {}, userSuper) + const administrations = await administrationsGet({}, userSuper) const { titresAsGsToCreate, titresAsGsToDelete } = titresAsGsToCreateAndDeleteBuild(titres, administrations) diff --git a/packages/api/src/business/processes/titres-etapes-administrations-locales-update.ts b/packages/api/src/business/processes/titres-etapes-administrations-locales-update.ts index e4e056547..4cd8464a1 100644 --- a/packages/api/src/business/processes/titres-etapes-administrations-locales-update.ts +++ b/packages/api/src/business/processes/titres-etapes-administrations-locales-update.ts @@ -239,7 +239,7 @@ const titresEtapesAdministrationsLocalesUpdate = async ( userSuper ) - const administrations = await administrationsGet({}, {}, userSuper) + const administrations = await administrationsGet({}, userSuper) // parcourt les étapes à partir des titres // car on a besoin de titre.domaineId diff --git a/packages/api/src/business/utils/titre-slug-and-relations-update.test.ts b/packages/api/src/business/utils/titre-slug-and-relations-update.test.ts index 7f3af6da7..19efe3a90 100644 --- a/packages/api/src/business/utils/titre-slug-and-relations-update.test.ts +++ b/packages/api/src/business/utils/titre-slug-and-relations-update.test.ts @@ -5,14 +5,12 @@ import { dbManager } from '../../../tests/db-manager' import { ITitre } from '../../types' import Titres from '../../database/models/titres' import { objectClone } from '../../tools' -const knex = dbManager.getKnex() beforeAll(async () => { - await dbManager.populateDb(knex) + await dbManager.populateDb() }) afterAll(async () => { - await dbManager.truncateDb(knex) - await dbManager.closeKnex(knex) + await dbManager.closeKnex() }) const titreAdd = async (titre: ITitre) => diff --git a/packages/api/src/database/models/administrations-types.ts b/packages/api/src/database/models/administrations-types.ts deleted file mode 100644 index d8e5ceb34..000000000 --- a/packages/api/src/database/models/administrations-types.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { Model, Modifiers } from 'objection' - -import { IAdministrationType } from '../../types' - -interface AdministrationsTypes extends IAdministrationType {} - -class AdministrationsTypes extends Model { - public static tableName = 'administrationsTypes' - - public static jsonSchema = { - type: 'object', - required: ['id', 'nom', 'ordre'], - - properties: { - id: { type: 'string', maxLength: 3 }, - nom: { type: ['string', 'null'], maxLength: 128 }, - ordre: { type: 'integer' } - } - } - - public static modifiers: Modifiers = { - orderAsc: builder => { - builder.orderBy('ordre', 'asc') - } - } -} - -export default AdministrationsTypes diff --git a/packages/api/src/database/models/administrations.ts b/packages/api/src/database/models/administrations.ts index 76a01a612..b01868114 100644 --- a/packages/api/src/database/models/administrations.ts +++ b/packages/api/src/database/models/administrations.ts @@ -4,7 +4,6 @@ import { IAdministration } from '../../types' import AdministrationsTitresTypesEtapesTypes from './administrations-titres-types-etapes-types' import AdministrationsTitresTypesTitresStatuts from './administrations-titres-types-titres-statuts' -import AdministrationsTypes from './administrations-types' import TitresTypes from './titres-types' import Utilisateurs from './utilisateurs' import Titres from './titres' @@ -19,37 +18,17 @@ class Administrations extends Model { public static jsonSchema = { type: 'object', - required: ['id', 'nom', 'typeId'], + required: ['id', 'typeId'], properties: { id: { type: 'string', maxLength: 64 }, typeId: { type: 'string' }, - nom: { type: 'string' }, - service: { type: ['string', 'null'] }, - url: { type: ['string', 'null'] }, - email: { type: ['string', 'null'] }, - telephone: { type: ['string', 'null'] }, - adresse1: { type: ['string', 'null'] }, - adresse2: { type: ['string', 'null'] }, - codePostal: { type: ['string', 'null'] }, - commune: { type: ['string', 'null'] }, - cedex: { type: ['string', 'null'] }, departementId: { type: ['string', 'null'] }, - regionId: { type: ['string', 'null'] }, - abreviation: { type: ['string', 'null'] } + regionId: { type: ['string', 'null'] } } } static relationMappings = () => ({ - type: { - relation: Model.BelongsToOneRelation, - modelClass: AdministrationsTypes, - join: { - from: 'administrations.typeId', - to: 'administrationsTypes.id' - } - }, - titresTypes: { relation: Model.ManyToManyRelation, modelClass: TitresTypes, diff --git a/packages/api/src/database/queries/_options.ts b/packages/api/src/database/queries/_options.ts index d959f7feb..fdec9042a 100644 --- a/packages/api/src/database/queries/_options.ts +++ b/packages/api/src/database/queries/_options.ts @@ -83,18 +83,10 @@ const utilisateursTitres = { graph: `[utilisateur]` } -const administrationsRelateTrue = [ - 'administrationsTypes', - 'departement', - 'region' -] - const administrations = { - graph: `[utilisateurs.permission, titresTypes.${titresTypes.graph}, titresTypesTitresStatuts, titresTypesEtapesTypes, type, departement, region]`, + graph: `[utilisateurs.permission, titresTypes.${titresTypes.graph}, titresTypesTitresStatuts, titresTypesEtapesTypes]`, update: { - insertMissing: true, - relate: administrationsRelateTrue, - unrelate: administrationsRelateTrue + insertMissing: true } } @@ -120,7 +112,6 @@ const titresEtapesRelateFalse = [ 'amodiataires.utilisateurs', 'amodiataires.utilisateurs.permission', 'administrations.titresTypes', - 'administrations.type', 'administrations.utilisateurs', 'administrations.utilisateurs.permission', 'substances.legales', @@ -215,7 +206,6 @@ const activitesTypesRelateFalse = [ 'frequence.trimestres', 'frequence.trimestres.mois', 'frequence.annees', - 'administrations.type', ...titresTypesRelateFalse.map(k => `type.titresTypes.${k}`) ] @@ -310,7 +300,10 @@ const titresRelateFalse = [ 'administrationsLocales.utilisateurs.permission', 'surfaceEtape', ...titresActivitesRelateFalse.map(k => `activites.${k}`), - ...titresDemarchesRelateFalse.map(k => `demarches.${k}`) + ...titresDemarchesRelateFalse.map(k => `demarches.${k}`), + 'titresAdministrations.region', + 'titresAdministrations.departement', + 'titresAdministrations.type' ] const titres = { diff --git a/packages/api/src/database/queries/administrations.ts b/packages/api/src/database/queries/administrations.ts index 302b698d3..a63f4299c 100644 --- a/packages/api/src/database/queries/administrations.ts +++ b/packages/api/src/database/queries/administrations.ts @@ -1,20 +1,15 @@ -import { QueryBuilder } from 'objection' - import { - IAdministration, - IAdministrationColonneId, - IAdministrationTitreType, - IAdministrationTitreTypeTitreStatut, - IAdministrationTitreTypeEtapeType, IAdministrationActiviteType, IAdministrationActiviteTypeEmail, + IAdministrationTitreType, + IAdministrationTitreTypeEtapeType, + IAdministrationTitreTypeTitreStatut, IFields, IUtilisateur } from '../../types' import graphBuild from './graph/build' import { fieldsFormat } from './graph/fields-format' -import { stringSplit } from './_utils' import options from './_options' import Administrations from '../models/administrations' @@ -25,45 +20,6 @@ import AdministrationsTitresTypesEtapesTypes from '../models/administrations-tit import AdministrationsActivitesTypes from '../models/administrations-activites-types' import AdministrationsActivitesTypesEmails from '../models/administrations-activites-types-emails' -const administrationsFiltersQueryModify = ( - { - noms, - typesIds, - administrationsIds - }: { - noms?: string | null - typesIds?: string[] | null - administrationsIds?: string[] | null - }, - q: QueryBuilder<Administrations, Administrations[]> -) => { - if (administrationsIds) { - q.whereIn('administrations.id', administrationsIds) - } - - if (noms) { - const nomsArray = stringSplit(noms) - - if (nomsArray) { - const fields = ['administrations.id', 'administrations.nom'] - - nomsArray.forEach(s => { - q.where(b => { - fields.forEach(f => { - b.orWhereRaw(`lower(??) like ?`, [f, `%${s.toLowerCase()}%`]) - }) - }) - }) - } - } - - if (typesIds) { - q.leftJoinRelated('type') - - q.whereIn('type.id', typesIds) - } -} - const administrationsQueryBuild = ( { fields }: { fields?: IFields }, user: IUtilisateur | null | undefined @@ -89,90 +45,13 @@ const administrationGet = async ( return q.findById(id) } -const administrationsCount = async ( - { - noms, - typesIds, - administrationsIds - }: { - noms?: string | null - typesIds?: string[] | null - administrationsIds?: string[] | null - }, - { fields }: { fields?: IFields }, - user: IUtilisateur | null | undefined -) => { - const q = administrationsQueryBuild({ fields }, user) - - administrationsFiltersQueryModify({ noms, typesIds, administrationsIds }, q) - - if (!q) return 0 - - return q.resultSize() -} - const administrationsGet = async ( - // eslint-disable-next-line @typescript-eslint/no-unused-vars - { - page, - intervalle, - ordre, - colonne, - noms, - typesIds, - administrationsIds - }: { - page?: number | null - intervalle?: number | null - ordre?: 'asc' | 'desc' | null - colonne?: IAdministrationColonneId | null - noms?: string | null - typesIds?: string[] | null - administrationsIds?: string[] | null - }, { fields }: { fields?: IFields }, user: IUtilisateur | null | undefined ) => { - const q = administrationsQueryBuild({ fields }, user) - - administrationsFiltersQueryModify({ noms, typesIds, administrationsIds }, q) - - // type: { id: 'type:type.nom', relation: 'type.type' } - if (colonne && colonne === 'type') { - q.leftJoinRelated('type') - q.groupBy('administrations.id') - q.groupBy('type.nom') - - q.orderBy('type.nom', ordre || 'asc') - } else if (colonne && colonne === 'nom') { - q.orderBy('administrations.nom', ordre || 'asc') - } else if (colonne && colonne === 'abreviation') { - q.orderBy('administrations.abreviation', ordre || 'asc') - } else { - q.orderBy('administrations.nom') - } - - if (page && intervalle) { - q.offset((page - 1) * intervalle) - } - - if (intervalle) { - q.limit(intervalle) - } - - return q + return administrationsQueryBuild({ fields }, user) } -const administrationsUpsert = async (administrations: IAdministration[]) => - Administrations.query() - .withGraphFetched(options.administrations.graph) - .upsertGraph(administrations, options.administrations.update) - -const administrationUpdate = async ( - id: string, - administration: Partial<IAdministration> -) => Administrations.query().patch(administration).findById(id) - const administrationTitreTypeUpsert = async ( administrationTitreType: IAdministrationTitreType ) => @@ -266,9 +145,6 @@ const administrationActiviteTypeEmailDelete = async ( export { administrationGet, administrationsGet, - administrationsCount, - administrationsUpsert, - administrationUpdate, administrationTitreTypeUpsert, administrationTitreTypeDelete, administrationTitreTypeTitreStatutUpsert, diff --git a/packages/api/src/database/queries/graph/fields-format.ts b/packages/api/src/database/queries/graph/fields-format.ts index 3621030bc..f0daf9e0f 100644 --- a/packages/api/src/database/queries/graph/fields-format.ts +++ b/packages/api/src/database/queries/graph/fields-format.ts @@ -25,13 +25,6 @@ const graphTitreAdministrationsFormat = (fields: IFields, type: string) => { fields[`administrations${type}`] = { ...fields.administrations } - - if ( - !fields.administrations.type && - Object.keys(fields.administrations).length !== 0 - ) { - fields[`administrations${type}`].type = { id: {} } - } } // ajoute des propriétés requises par /database/queries/_format @@ -109,15 +102,13 @@ const fieldsFormat = (fields: IFields, parent: string) => { if (fields.administrations) { if (isParentTitre) { - // ajoute la propriété `type` sur les administrations graphTitreAdministrationsFormat(fields, 'Locales') graphTitreAdministrationsFormat(fields, 'Gestionnaires') delete fields.administrations - } else if ( - !fields.administrations.type && - Object.keys(fields.administrations).length !== 0 - ) { - fields.administrations.type = { id: {} } + } else { + delete fields.administrations.type + delete fields.administrations.departement + delete fields.administrations.region } } @@ -159,6 +150,10 @@ const fieldsFormat = (fields: IFields, parent: string) => { if (!fields.type.administrations) { fields.type.administrations = { id: {} } + } else { + delete fields.type.administrations.type + delete fields.type.administrations.departement + delete fields.type.administrations.region } if (!fields.type.documentsTypes) { @@ -230,6 +225,12 @@ const fieldsFormat = (fields: IFields, parent: string) => { } } + if (['administration', 'administrations'].includes(parent)) { + delete fields.type + delete fields.departement + delete fields.region + } + return fields } diff --git a/packages/api/src/database/queries/metas.ts b/packages/api/src/database/queries/metas.ts index 8d797d55a..e41e3e27a 100644 --- a/packages/api/src/database/queries/metas.ts +++ b/packages/api/src/database/queries/metas.ts @@ -13,7 +13,6 @@ import { IEtapeStatut, IDevise, IUnite, - IAdministrationType, IPermission, IGeoSysteme, IDocumentType, @@ -50,7 +49,6 @@ import TitresTypesTypes from '../models/titres-types-types' import Unites from '../models/unites' import EtapesStatuts from '../models/etapes-statuts' import SubstancesLegalesCodes from '../models/substances-legales-codes' -import AdministrationsTypes from '../models/administrations-types' import { domainesQueryModify, @@ -634,14 +632,6 @@ const etapeStatutUpdate = async (id: string, props: Partial<IEtapeStatut>) => const substancesLegalesCodesGet = async () => SubstancesLegalesCodes.query().orderBy('ordre') -const administrationsTypesGet = async () => - AdministrationsTypes.query().orderBy('ordre') - -const administrationTypeUpdate = async ( - id: string, - props: Partial<IAdministrationType> -) => AdministrationsTypes.query().patchAndFetchById(id, props) - export { domaineGet, domainesGet, @@ -675,8 +665,6 @@ export { etapesStatutsGet, etapeStatutUpdate, substancesLegalesCodesGet, - administrationsTypesGet, - administrationTypeUpdate, permissionUpdate, geoSystemeUpdate, documentTypeCreate, diff --git a/packages/api/src/database/queries/permissions/administrations.test.ts b/packages/api/src/database/queries/permissions/administrations.test.ts index d23c62a16..7ddcb3743 100644 --- a/packages/api/src/database/queries/permissions/administrations.test.ts +++ b/packages/api/src/database/queries/permissions/administrations.test.ts @@ -15,15 +15,13 @@ import options from '../_options' console.info = jest.fn() console.error = jest.fn() -const knex = dbManager.getKnex() beforeAll(async () => { - await dbManager.populateDb(knex) + await dbManager.populateDb() }) afterAll(async () => { - await dbManager.truncateDb(knex) - await dbManager.closeKnex(knex) + await dbManager.closeKnex() }) describe('administrationsTitresQuery', () => { diff --git a/packages/api/src/database/queries/permissions/administrations.ts b/packages/api/src/database/queries/permissions/administrations.ts index 7cf8ff18a..5d99d3ad8 100644 --- a/packages/api/src/database/queries/permissions/administrations.ts +++ b/packages/api/src/database/queries/permissions/administrations.ts @@ -67,20 +67,8 @@ const administrationsQueryModify = ( const administrationsIds = user?.administrations?.map(a => a.id) || [] const administrationsIdsReplace = administrationsIds.map(() => '?') - // Propriété "membre" - // TODO: vérifier si utile et utilisé, particulièrement en frontend. if (permissionCheck(user?.permissionId, ['super'])) { q.select(raw('true').as('modification')) - } else if ( - permissionCheck(user?.permissionId, ['admin', 'editeur', 'lecteur']) && - user?.administrations?.length - ) { - q.select( - raw( - `(case when ?? in (${administrationsIdsReplace}) then true else false end)`, - ['administrations.id', ...administrationsIds] - ).as('membre') - ) } if ( diff --git a/packages/api/src/database/queries/permissions/documents.test.ts b/packages/api/src/database/queries/permissions/documents.test.ts index db711ac06..9c55fab52 100644 --- a/packages/api/src/database/queries/permissions/documents.test.ts +++ b/packages/api/src/database/queries/permissions/documents.test.ts @@ -13,14 +13,13 @@ import { etapeTypeDocumentTypeUsedCheck } from './documents' console.info = jest.fn() console.error = jest.fn() -const knex = dbManager.getKnex() +let knex beforeAll(async () => { - await dbManager.populateDb(knex) + knex = await dbManager.populateDb() }) afterAll(async () => { - await dbManager.truncateDb(knex) - await dbManager.closeKnex(knex) + await dbManager.closeKnex() }) describe('documentSupprimer', () => { diff --git a/packages/api/src/database/queries/permissions/entreprises.test.ts b/packages/api/src/database/queries/permissions/entreprises.test.ts index b9d78f673..da560d478 100644 --- a/packages/api/src/database/queries/permissions/entreprises.test.ts +++ b/packages/api/src/database/queries/permissions/entreprises.test.ts @@ -8,14 +8,12 @@ import { entreprisesQueryModify } from './entreprises' console.info = jest.fn() console.error = jest.fn() -const knex = dbManager.getKnex() beforeAll(async () => { - await dbManager.populateDb(knex) + await dbManager.populateDb() }) afterAll(async () => { - await dbManager.truncateDb(knex) - await dbManager.closeKnex(knex) + await dbManager.closeKnex() }) describe('entreprisesQueryModify', () => { diff --git a/packages/api/src/database/queries/permissions/metas.test.ts b/packages/api/src/database/queries/permissions/metas.test.ts index ad69cc145..87e0c63f3 100644 --- a/packages/api/src/database/queries/permissions/metas.test.ts +++ b/packages/api/src/database/queries/permissions/metas.test.ts @@ -6,18 +6,16 @@ import Titres from '../../models/titres' import { IDemarcheType, IUtilisateur } from '../../../types' import AdministrationsTitresTypes from '../../models/administrations-titres-types' import AdministrationsTitresTypesTitresStatuts from '../../models/administrations-titres-types-titres-statuts' -import Administrations from '../../models/administrations' +import { Administrations } from 'camino-common/src/administrations' console.info = jest.fn() console.error = jest.fn() -const knex = dbManager.getKnex() beforeAll(async () => { - await dbManager.populateDb(knex) + await dbManager.populateDb() }) afterAll(async () => { - await dbManager.truncateDb(knex) - await dbManager.closeKnex(knex) + await dbManager.closeKnex() }) describe('metas permissions queries', () => { @@ -61,9 +59,7 @@ describe('metas permissions queries', () => { etapesModificationInterdit: false }) - const administration = await Administrations.query().findById( - administrationId - ) + const administration = Administrations[administrationId] const q = DemarchesTypes.query() demarchesTypesQueryModify( diff --git a/packages/api/src/database/queries/permissions/titres-demarches.test.ts b/packages/api/src/database/queries/permissions/titres-demarches.test.ts index 9cf2a4db5..a04cfd570 100644 --- a/packages/api/src/database/queries/permissions/titres-demarches.test.ts +++ b/packages/api/src/database/queries/permissions/titres-demarches.test.ts @@ -14,15 +14,12 @@ import TitresEtapes from '../../models/titres-etapes' console.info = jest.fn() console.error = jest.fn() -const knex = dbManager.getKnex() - beforeAll(async () => { - await dbManager.populateDb(knex) + await dbManager.populateDb() }) afterAll(async () => { - await dbManager.truncateDb(knex) - await dbManager.closeKnex(knex) + await dbManager.closeKnex() }) describe('titresDemarchesQueryModify', () => { diff --git a/packages/api/src/database/queries/permissions/titres-etapes.test.ts b/packages/api/src/database/queries/permissions/titres-etapes.test.ts index 7901cf55e..d34e44cae 100644 --- a/packages/api/src/database/queries/permissions/titres-etapes.test.ts +++ b/packages/api/src/database/queries/permissions/titres-etapes.test.ts @@ -10,14 +10,12 @@ import TitresDemarches from '../../models/titres-demarches' console.info = jest.fn() console.error = jest.fn() -const knex = dbManager.getKnex() beforeAll(async () => { - await dbManager.populateDb(knex) + await dbManager.populateDb() }) afterAll(async () => { - await dbManager.truncateDb(knex) - await dbManager.closeKnex(knex) + await dbManager.closeKnex() }) describe('titresEtapesQueryModify', () => { diff --git a/packages/api/src/database/queries/permissions/titres.test.ts b/packages/api/src/database/queries/permissions/titres.test.ts index 556006f18..436deff88 100644 --- a/packages/api/src/database/queries/permissions/titres.test.ts +++ b/packages/api/src/database/queries/permissions/titres.test.ts @@ -23,17 +23,19 @@ import AdministrationsTitresTypes from '../../models/administrations-titres-type import AdministrationsTitresTypesTitresStatuts from '../../models/administrations-titres-types-titres-statuts' import Administrations from '../../models/administrations' import { userSuper } from '../../user-super' +import { + ADMINISTRATION_IDS, + Administrations as CommonAdministrations +} from 'camino-common/src/administrations' console.info = jest.fn() console.error = jest.fn() -const knex = dbManager.getKnex() beforeAll(async () => { - await dbManager.populateDb(knex) + await dbManager.populateDb() }) afterAll(async () => { - await dbManager.truncateDb(knex) - await dbManager.closeKnex(knex) + await dbManager.closeKnex() }) describe('titresQueryModify', () => { @@ -264,19 +266,19 @@ describe('titresQueryModify', () => { describe('titresTravauxCreationQuery', () => { test.each` - administrationId | gestionnaire | travauxCreation - ${'dre-ile-de-france-01'} | ${false} | ${false} - ${'dea-guadeloupe-01'} | ${false} | ${false} - ${'min-mtes-dgec-01'} | ${false} | ${false} - ${'pre-42218-01'} | ${false} | ${false} - ${'ope-ptmg-973-01'} | ${false} | ${false} - ${'dre-ile-de-france-01'} | ${true} | ${true} - ${'dea-guadeloupe-01'} | ${true} | ${true} - ${'min-mtes-dgec-01'} | ${true} | ${false} - ${'pre-42218-01'} | ${true} | ${false} - ${'ope-ptmg-973-01'} | ${true} | ${false} + administrationId | gestionnaire | travauxCreation + ${'dre-ile-de-france-01'} | ${false} | ${false} + ${'dea-guadeloupe-01'} | ${false} | ${false} + ${'min-mtes-dgec-01'} | ${false} | ${false} + ${'pre-42218-01'} | ${false} | ${false} + ${'ope-ptmg-973-01'} | ${false} | ${false} + ${'dre-ile-de-france-01'} | ${true} | ${true} + ${ADMINISTRATION_IDS['DEAL - GUADELOUPE']} | ${true} | ${true} + ${'min-mtes-dgec-01'} | ${true} | ${false} + ${'pre-42218-01'} | ${true} | ${false} + ${'ope-ptmg-973-01'} | ${true} | ${false} `( - 'Vérifie si le $administrationId peut créer des travaux', + 'Vérifie si le $administrationId, gestionnaire $gestionnaire peut créer des travaux ($travauxCreation)', async ({ administrationId, gestionnaire, travauxCreation }) => { const titreId = idGenerate() @@ -299,9 +301,7 @@ describe('titresQueryModify', () => { await AdministrationsTitresTypesTitresStatuts.query().delete() - const administration = await Administrations.query().findById( - administrationId - ) + const administration = CommonAdministrations[administrationId] const q = Titres.query() titresTravauxCreationQuery(q, { diff --git a/packages/api/src/database/queries/permissions/utilisateurs.test.ts b/packages/api/src/database/queries/permissions/utilisateurs.test.ts index f7dbad0b3..a313efc5b 100644 --- a/packages/api/src/database/queries/permissions/utilisateurs.test.ts +++ b/packages/api/src/database/queries/permissions/utilisateurs.test.ts @@ -1,27 +1,23 @@ import { IAdministration, IUtilisateur } from '../../../types' import { dbManager } from '../../../../tests/db-manager' -import Administrations from '../../models/administrations' import Utilisateurs from '../../models/utilisateurs' import { utilisateursGet } from '../utilisateurs' +import { Administrations } from 'camino-common/src/administrations' +import options from '../_options' console.info = jest.fn() console.error = jest.fn() -const knex = dbManager.getKnex() beforeAll(async () => { - await dbManager.populateDb(knex) + await dbManager.populateDb() + await Utilisateurs.query().insertGraph(mockUser, options.utilisateurs.update) }) afterAll(async () => { - await dbManager.truncateDb(knex) - await dbManager.closeKnex(knex) + await dbManager.closeKnex() }) -const mockAdministration = { - id: 'administrationId', - typeId: 'ope', - nom: 'administrationNom' -} as IAdministration +const mockAdministration = Administrations['aut-97300-01'] const mockUser = { id: 'utilisateurId', @@ -29,7 +25,7 @@ const mockUser = { nom: 'utilisateurNom', email: 'utilisateurEmail', motDePasse: 'utilisateurMotdepasse', - administrations: [mockAdministration] + administrations: [{ id: mockAdministration.id }] } as IUtilisateur describe('utilisateursQueryModify', () => { @@ -44,15 +40,10 @@ describe('utilisateursQueryModify', () => { `( "Vérifie l'écriture de la requête sur un utilisateur", async ({ permissionId, voit }) => { - await Utilisateurs.query().delete() - await Administrations.query().delete() - - await Utilisateurs.query().insertGraph(mockUser) - const user = { id: 'userId', permissionId, - administrations: [mockAdministration] + administrations: [mockAdministration] as unknown as IAdministration[] } as IUtilisateur const utilisateurs = await utilisateursGet( diff --git a/packages/api/src/database/queries/titres-activites.test.ts b/packages/api/src/database/queries/titres-activites.test.ts index 70ecfa2f2..c4bd930b6 100644 --- a/packages/api/src/database/queries/titres-activites.test.ts +++ b/packages/api/src/database/queries/titres-activites.test.ts @@ -7,14 +7,12 @@ import Titres from '../models/titres' import AdministrationsTitresTypes from '../models/administrations-titres-types' console.info = jest.fn() console.error = jest.fn() -const knex = dbManager.getKnex() beforeAll(async () => { - await dbManager.populateDb(knex) + await dbManager.populateDb() }) afterAll(async () => { - await dbManager.truncateDb(knex) - await dbManager.closeKnex(knex) + await dbManager.closeKnex() }) describe('teste les requêtes sur les activités', () => { test('vérifie que le filtrage fonctionne pour les administrations', async () => { diff --git a/packages/api/src/database/queries/titres-demarches.test.ts b/packages/api/src/database/queries/titres-demarches.test.ts index a84698257..ee2ea3dd0 100644 --- a/packages/api/src/database/queries/titres-demarches.test.ts +++ b/packages/api/src/database/queries/titres-demarches.test.ts @@ -8,14 +8,12 @@ import { titreDemarcheArchive } from './titres-demarches' console.info = jest.fn() console.error = jest.fn() -const knex = dbManager.getKnex() beforeAll(async () => { - await dbManager.populateDb(knex) + await dbManager.populateDb() }) afterAll(async () => { - await dbManager.truncateDb(knex) - await dbManager.closeKnex(knex) + await dbManager.closeKnex() }) describe('teste les requêtes sur les démarches', () => { describe('titreDemarcheArchive', () => { diff --git a/packages/api/src/database/queries/titres.test.ts b/packages/api/src/database/queries/titres.test.ts index 7e77c1b1b..9bd95b90f 100644 --- a/packages/api/src/database/queries/titres.test.ts +++ b/packages/api/src/database/queries/titres.test.ts @@ -7,14 +7,12 @@ import { titreArchive } from './titres' console.info = jest.fn() console.error = jest.fn() -const knex = dbManager.getKnex() beforeAll(async () => { - await dbManager.populateDb(knex) + await dbManager.populateDb() }) afterAll(async () => { - await dbManager.truncateDb(knex) - await dbManager.closeKnex(knex) + await dbManager.closeKnex() }) describe('teste les requêtes sur les titres', () => { describe('titreArchive', () => { diff --git a/packages/api/src/knex/migrations-schema/20220427075921_administrations_delete.js b/packages/api/src/knex/migrations-schema/20220427075921_administrations_delete.js new file mode 100644 index 000000000..c1cf4e61c --- /dev/null +++ b/packages/api/src/knex/migrations-schema/20220427075921_administrations_delete.js @@ -0,0 +1,20 @@ +exports.up = async knex => { + await knex.schema.table('administrations', table => { + table.dropColumn('nom') + table.dropColumn('abreviation') + table.dropColumn('service') + table.dropColumn('url') + table.dropColumn('email') + table.dropColumn('telephone') + table.dropColumn('adresse1') + table.dropColumn('adresse2') + table.dropColumn('code_postal') + table.dropColumn('commune') + table.dropColumn('cedex') + table.dropForeign('typeid') + }) + + return knex.schema.dropTable('administrations_types') +} + +exports.down = () => ({}) diff --git a/packages/api/src/knex/seeds/07-administrations.js b/packages/api/src/knex/seeds/07-administrations.js index 594082293..e2eebeb3c 100644 --- a/packages/api/src/knex/seeds/07-administrations.js +++ b/packages/api/src/knex/seeds/07-administrations.js @@ -1,10 +1,15 @@ const seeding = require('../seeding') - -const administrations = require('../../../sources/administrations.json') -const administrationsTypes = require('../../../sources/administrations-types.json') +const { sortedAdministrations } = require('camino-common/src/administrations') const seed = seeding(async ({ insert }) => { - await insert('administrationsTypes', administrationsTypes) + const administrations = sortedAdministrations.map( + ({ id, typeId, regionId, departementId }) => ({ + id, + typeId, + regionId, + departementId + }) + ) await insert('administrations', administrations) }) diff --git a/packages/api/src/scripts/administrations-update.ts b/packages/api/src/scripts/administrations-update.ts new file mode 100644 index 000000000..55c519a82 --- /dev/null +++ b/packages/api/src/scripts/administrations-update.ts @@ -0,0 +1,60 @@ +import '../init' + +import { organismesDepartementsGet } from '../tools/api-administrations' +import { Administrations } from 'camino-common/src/administrations' +import { DepartementId } from 'camino-common/src/departement' +import { readFileSync, writeFileSync } from 'fs' + +const administrationsUpdate = async () => { + console.info() + console.info('administrations…') + + // // mise à jour de l'administrations grâce à l'API Administration + const departementsIds = Object.values(Administrations) + .map(a => a.departementId) + .filter( + (a: DepartementId | undefined): a is DepartementId => a !== undefined + ) + .map(departementId => ({ + departementId, + nom: departementId === '75' ? 'paris_ppp' : 'prefecture' + })) + + const newAdministrations = await organismesDepartementsGet(departementsIds) + + if (!newAdministrations) return + + const administrations = { ...Administrations } + + newAdministrations.forEach(a => { + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + administrations[a.id] = a + }) + + const data = readFileSync('packages/common/src/administrations.ts', { + encoding: 'utf-8' + }) + + const startComment = '// ----- ne pas supprimer cette ligne : début' + const stopComment = '// ----- ne pas supprimer cette ligne : fin' + const startIndex = data.indexOf(startComment) + const preCode = data.slice(0, startIndex + startComment.length + 1) + const postCode = data.slice(data.indexOf(stopComment)) + + const code = JSON.stringify(administrations, null, 3) + + writeFileSync( + 'packages/common/src/administrations.ts', + preCode + code + postCode + ) +} + +administrationsUpdate() + .then(() => { + process.exit() + }) + .catch(e => { + console.error(e) + process.exit(1) + }) diff --git a/packages/api/src/tools/api-administrations/index.ts b/packages/api/src/tools/api-administrations/index.ts index c209cba23..c78a377b8 100644 --- a/packages/api/src/tools/api-administrations/index.ts +++ b/packages/api/src/tools/api-administrations/index.ts @@ -1,15 +1,15 @@ // https://etablissements-publics.api.gouv.fr import PQueue from 'p-queue' -import { join } from 'path' import fetch from 'node-fetch' -import makeDir from 'make-dir' - -import { IAdministration } from '../../types' import errorLog from '../error-log' -import fileCreate from '../file-create' +import { DepartementId } from 'camino-common/src/departement' +import { + Administration, + AdministrationId, + AdministrationTypeId +} from 'camino-common/src/administrations' -const CACHE_DIR = 'api-cache/administration/' const MAX_CALLS_MINUTE = 200 const { API_ADMINISTRATION_URL } = process.env @@ -68,34 +68,7 @@ const organismeFetch = async (departementId: string, nom: string) => { const organismeDepartementCall = async (departementId: string, nom: string) => { try { - let result - - if (process.env.NODE_ENV === 'development') { - await makeDir(CACHE_DIR) - const cacheFilePath = join( - CACHE_DIR, - `organisme-${departementId}-${nom}on` - ) - - try { - result = require(`../../../${cacheFilePath}`) as IOrganisme - console.info( - `API Administration: lecture de l'organisme depuis le cache, département: ${departementId}, type: ${nom}` - ) - } catch (e) { - console.info( - `API Administration: pas de fichier de cache ${cacheFilePath}` - ) - - result = await organismeFetch(departementId, nom) - - await fileCreate(cacheFilePath, JSON.stringify(result, null, 2)) - } - } else { - result = await organismeFetch(departementId, nom) - } - - return result + return await organismeFetch(departementId, nom) } catch (err: any) { const error = err.error ? `${err.error}: ${err.error_description}` : err errorLog(`API administrations ${departementId} ${nom}:`, error) @@ -104,58 +77,66 @@ const organismeDepartementCall = async (departementId: string, nom: string) => { } } -const organismeFormat = (e: IOrganisme, departementId: string) => { +const organismeFormat = (e: IOrganisme, departementId: DepartementId) => { if (!e.features.length) return null const { properties: p } = e.features[0] const { adresses } = p - let organisme - try { - const [adresseA, adresseB] = adresses - - const adresse1 = adresseA.lignes - .reduce((acc: string[], line) => { - if (line.length <= 100) { - acc.push(line) - } - - return acc - }, []) - .join(', ') - - const adresse2 = adresseB ? adresseB.lignes.join(', ') : null - - organisme = { - id: p.id.replace(/prefecture|paris_ppp/, 'pre'), - typeId: p.pivotLocal.replace(/prefecture|paris_ppp/, 'pre'), - nom: p.nom, - adresse1, - adresse2, - codePostal: adresses[0].codePostal, - commune: adresses[0].commune, - telephone: p.telephone, - email: p.email && p.email.match('@') ? p.email : null, - url: p.url || null, - departementId - } as IAdministration - } catch (error) { - console.error(p, organisme) - throw error + const [adresseA, adresseB] = adresses + + const adresse1 = adresseA.lignes + .reduce((acc: string[], line) => { + if (line.length <= 100) { + acc.push(line) + } + + return acc + }, []) + .join(', ') + + const organisme: Administration = { + id: p.id.replace(/prefecture|paris_ppp/, 'pre') as AdministrationId, + typeId: p.pivotLocal.replace( + /prefecture|paris_ppp/, + 'pre' + ) as AdministrationTypeId, + nom: p.nom, + abreviation: p.nom, + adresse1, + codePostal: adresses[0].codePostal, + commune: adresses[0].commune, + telephone: p.telephone, + departementId + } + const adresse2 = adresseB ? adresseB.lignes.join(', ') : null + if (adresse2) { + organisme.adresse2 = adresse2 + } + const email = p.email && p.email.match('@') ? p.email : null + if (email) { + organisme.email = email + } + const url = p.url || null + if (url) { + organisme.url = url } return organisme } -const organismeDepartementGet = async (departementId: string, nom: string) => { +const organismeDepartementGet = async ( + departementId: DepartementId, + nom: string +) => { const organisme = await organismeDepartementCall(departementId, nom) return organisme ? organismeFormat(organisme, departementId) : null } const organismesDepartementsGet = async ( - departementsIdsNoms: { departementId: string; nom: string }[] -) => { + departementsIdsNoms: { departementId: DepartementId; nom: string }[] +): Promise<Administration[]> => { const administrationsOrganismesRequests = departementsIdsNoms.map( ({ departementId, nom }) => () => @@ -168,7 +149,7 @@ const organismesDepartementsGet = async ( administrationsOrganismesRequests ) - return organismesDepartements.filter(o => o) as IAdministration[] + return organismesDepartements.filter((o): o is Administration => !!o) } -export { organismeDepartementGet, organismesDepartementsGet } +export { organismesDepartementsGet } diff --git a/packages/api/src/tools/database-to-json/tables.ts b/packages/api/src/tools/database-to-json/tables.ts index ea54cb607..8d23c25c1 100644 --- a/packages/api/src/tools/database-to-json/tables.ts +++ b/packages/api/src/tools/database-to-json/tables.ts @@ -11,7 +11,6 @@ const tables = [ name: 'activites_types__titres_types', orderBy: ['titre_type_id', 'activite_type_id'] }, - { name: 'administrations', orderBy: ['id'] }, { name: 'administrations__activites_types', orderBy: ['activite_type_id', 'administration_id'] @@ -28,7 +27,6 @@ const tables = [ name: 'administrations__titres_types__titres_statuts', orderBy: ['administration_id', 'titre_type_id', 'titre_statut_id'] }, - { name: 'administrations_types', orderBy: ['id'] }, { name: 'annees', orderBy: ['id'] }, // la table 'caches' n'est pas utile dans les json // { name: 'caches',orderBy: ['id'] }, diff --git a/packages/api/src/types.ts b/packages/api/src/types.ts index da01f0b4f..a5c7dadad 100644 --- a/packages/api/src/types.ts +++ b/packages/api/src/types.ts @@ -1,5 +1,12 @@ /* eslint-disable no-undef */ import { FileUpload } from 'graphql-upload' +import { + AdministrationId, + AdministrationType, + AdministrationTypeId +} from 'camino-common/src/administrations' +import { Departement, DepartementId } from 'camino-common/src/departement' +import { Region } from 'camino-common/src/region' enum DemarchesStatutsTypes { Accepte = 'acc', @@ -100,7 +107,6 @@ type ITitreActiviteColonneId = 'titreNom' | 'titulaire' | 'periode' | 'statut' type IUtilisateursColonneId = 'nom' | 'prenom' | 'email' | 'permission' | 'lien' type IEntrepriseColonneId = 'nom' | 'siren' -type IAdministrationColonneId = 'abreviation' | 'nom' | 'type' type ICouleur = 'error' | 'info' | 'neutral' | 'success' | 'warning' interface IActiviteStatut { @@ -226,17 +232,11 @@ interface IActiviteType { modification?: boolean | null } -interface IAdministrationType { - id: string - nom: string - ordre: number -} - interface IAdministration { - id: string - typeId: string + id: AdministrationId + typeId: AdministrationTypeId nom: string - type?: IAdministrationType + type?: AdministrationType service?: string | null url?: string | null email?: string | null @@ -246,8 +246,10 @@ interface IAdministration { codePostal?: string | null commune?: string | null cedex?: string | null - departementId?: string | null + departementId?: DepartementId | null + departement?: Departement regionId?: string | null + region?: Region abreviation?: string | null titresTypes?: (ITitreType & IAdministrationTitreType)[] | null titresTypesTitresStatuts?: IAdministrationTitreTypeTitreStatut[] | null @@ -257,7 +259,6 @@ interface IAdministration { gestionnaireTitres?: ITitre[] | null localeTitres?: ITitre[] | null associee?: boolean | null - membre?: boolean emailsModification?: boolean emailsLecture?: boolean modification?: boolean | null @@ -1073,7 +1074,6 @@ export { ISectionElement, ISectionElementType, IAdministration, - IAdministrationType, IAnnee, ICommune, IArea, @@ -1168,7 +1168,6 @@ export { ITitreActiviteColonneId, IUtilisateursColonneId, IEntrepriseColonneId, - IAdministrationColonneId, IColonne, IContenuId, IPropsTitreEtapesIds, diff --git a/packages/api/tests/_utils/administrations.ts b/packages/api/tests/_utils/administrations.ts index 8c700bd3a..bf06b11fa 100644 --- a/packages/api/tests/_utils/administrations.ts +++ b/packages/api/tests/_utils/administrations.ts @@ -13,12 +13,12 @@ import { } from '../../src/types' import { objectClone } from '../../src/tools/index' +import { + Administration, + Administrations +} from 'camino-common/src/administrations' interface ISources { - administrations: { - path: string - data: IAdministration[] - } titresTypes: { path: string data: ITitreType[] @@ -40,7 +40,6 @@ interface ISources { } const sources = { - administrations: { path: '../../sources/administrations.json', data: [] }, titresTypes: { path: '../../sources/titres-types.json', data: [] }, titresStatuts: { path: '../../sources/titres-statuts.json', data: [] }, administrations__titresTypes: { @@ -105,59 +104,60 @@ Object.keys(sources).forEach(name => { element.data = jsonKeysCaseChange(readFile(element.path)) }) -const administrationsWithRelations = sources.administrations.data.map( - (a: IAdministration) => { - a.titresTypes = sources.administrations__titresTypes.data - .filter(att => att.administrationId === a.id) - .map(att => { - const titreType = objectClone( - sources.titresTypes.data.find(tt => att.titreTypeId === tt.id)! - ) as ITitreType & IAdministrationTitreType - - titreType.administrationId = att.administrationId - titreType.titreTypeId = att.titreTypeId - - if (att.associee) { - titreType.associee = true - } - - if (att.gestionnaire) { - titreType.gestionnaire = true - } +const administrationsWithRelations = Object.values( + Administrations +).map<IAdministration>((a: Administration) => { + const dbadmin: IAdministration = { ...a } + dbadmin.titresTypes = sources.administrations__titresTypes.data + .filter(att => att.administrationId === a.id) + .map(att => { + const titreType = objectClone( + sources.titresTypes.data.find(tt => att.titreTypeId === tt.id)! + ) as ITitreType & IAdministrationTitreType + + titreType.administrationId = att.administrationId + titreType.titreTypeId = att.titreTypeId + + if (att.associee) { + titreType.associee = true + } + + if (att.gestionnaire) { + titreType.gestionnaire = true + } + + return titreType + }) + + dbadmin.titresTypesTitresStatuts = + sources.administrations__titresTypes__titresStatuts.data + .filter(attts => attts.administrationId === a.id) + .map(attts => { + attts.titreType = sources.titresTypes.data.find( + tt => tt.id === attts.titreTypeId + ) + attts.titreStatut = sources.titresStatuts.data.find( + ts => ts.id === attts.titreStatutId + ) + + return attts + }) - return titreType + dbadmin.titresTypesEtapesTypes = + sources.administrations__titresTypes__etapesTypes.data + .filter(attet => attet.administrationId === a.id) + .map(attet => { + attet.titreType = sources.titresTypes.data.find( + tt => tt.id === attet.titreTypeId + ) + attet.etapeType = sources.etapesTypes.data.find( + te => te.id === attet.etapeTypeId + ) + + return attet }) - a.titresTypesTitresStatuts = - sources.administrations__titresTypes__titresStatuts.data - .filter(attts => attts.administrationId === a.id) - .map(attts => { - attts.titreType = sources.titresTypes.data.find( - tt => tt.id === attts.titreTypeId - ) - attts.titreStatut = sources.titresStatuts.data.find( - ts => ts.id === attts.titreStatutId - ) - - return attts - }) - - a.titresTypesEtapesTypes = - sources.administrations__titresTypes__etapesTypes.data - .filter(attet => attet.administrationId === a.id) - .map(attet => { - attet.titreType = sources.titresTypes.data.find( - tt => tt.id === attet.titreTypeId - ) - attet.etapeType = sources.etapesTypes.data.find( - te => te.id === attet.etapeTypeId - ) - - return attet - }) - - return a - } -) + return dbadmin +}) export { administrationsWithRelations } diff --git a/packages/api/tests/administration.test.ts b/packages/api/tests/administration.test.ts index 0b111ded2..e60c5a513 100644 --- a/packages/api/tests/administration.test.ts +++ b/packages/api/tests/administration.test.ts @@ -1,57 +1,16 @@ import { graphQLCall, queryImport } from './_utils/index' -import { administrationsUpsert } from '../src/database/queries/administrations' import { dbManager } from './db-manager' +import { ADMINISTRATION_IDS } from 'camino-common/src/administrations' console.info = jest.fn() console.error = jest.fn() -const knex = dbManager.getKnex() beforeAll(async () => { - await dbManager.populateDb(knex) + await dbManager.populateDb() }) afterAll(async () => { - await dbManager.truncateDb(knex) - await dbManager.closeKnex(knex) -}) - -const administration = { - id: 'admin-id', - nom: "Nom de l'administration", - typeId: 'ope', - abreviation: 'abréviation' -} - -describe('administrationModifier', () => { - const administrationModifierQuery = queryImport('administration-modifier') - beforeEach(async () => { - await administrationsUpsert([administration]) - }) - - test('ne peut pas modifier une administration (anonyme)', async () => { - const res = await graphQLCall(administrationModifierQuery, { - administration: Object.assign({}, administration, { adresse1: 'adresse' }) - }) - - expect(res.body.errors[0].message).toBe('droits insuffisants') - }) - - test("modifie une administration (un utilisateur 'super')", async () => { - const res = await graphQLCall( - administrationModifierQuery, - { - administration: Object.assign({}, administration, { - adresse1: 'adresse' - }) - }, - 'super' - ) - - expect(res.body).toMatchObject({ - data: { administrationModifier: { adresse1: 'adresse' } } - }) - expect(res.body.errors).toBeUndefined() - }) + await dbManager.closeKnex() }) describe('administrationTitreTypeModifier', () => { @@ -59,14 +18,10 @@ describe('administrationTitreTypeModifier', () => { 'administration-titre-type-modifier' ) - beforeEach(async () => { - await administrationsUpsert([administration]) - }) - test("ne peut pas modifier les types de titres d'une administration (anonyme)", async () => { const res = await graphQLCall(administrationTitreTypeModifierQuery, { administrationTitreType: { - administrationId: 'admin-id', + administrationId: ADMINISTRATION_IDS.BRGM, titreTypeId: 'arm', gestionnaire: true, associee: false @@ -81,7 +36,7 @@ describe('administrationTitreTypeModifier', () => { administrationTitreTypeModifierQuery, { administrationTitreType: { - administrationId: 'admin-id', + administrationId: ADMINISTRATION_IDS.BRGM, titreTypeId: 'arm', gestionnaire: true, associee: false @@ -93,7 +48,7 @@ describe('administrationTitreTypeModifier', () => { expect(res.body).toMatchObject({ data: { administrationTitreTypeModifier: { - id: 'admin-id', + id: ADMINISTRATION_IDS.BRGM, titresTypes: [{ id: 'arm', gestionnaire: true, associee: false }] } } @@ -107,14 +62,10 @@ describe('administrationTitreTypeModifier', () => { 'administration-titre-type-modifier' ) - beforeEach(async () => { - await administrationsUpsert([administration]) - }) - test("ne peut pas modifier les types de titres d'une administration (anonyme)", async () => { const res = await graphQLCall(administrationTitreTypeModifierQuery, { administrationTitreType: { - administrationId: 'admin-id', + administrationId: ADMINISTRATION_IDS.BRGM, titreTypeId: 'arm', gestionnaire: true, associee: false @@ -129,7 +80,7 @@ describe('administrationTitreTypeModifier', () => { administrationTitreTypeModifierQuery, { administrationTitreType: { - administrationId: 'admin-id', + administrationId: ADMINISTRATION_IDS.BRGM, titreTypeId: 'arm', gestionnaire: true, associee: false @@ -141,7 +92,7 @@ describe('administrationTitreTypeModifier', () => { expect(res.body).toMatchObject({ data: { administrationTitreTypeModifier: { - id: 'admin-id', + id: ADMINISTRATION_IDS.BRGM, titresTypes: [{ id: 'arm', gestionnaire: true, associee: false }] } } @@ -155,16 +106,12 @@ describe('administrationTitreTypeTitreStatutModifier', () => { 'administration-titre-type-titre-statut-modifier' ) - beforeEach(async () => { - await administrationsUpsert([administration]) - }) - test("ne peut pas modifier les types de titre / statuts de titre d'une administration (anonyme)", async () => { const res = await graphQLCall( administrationTitreTypeTitreStatutModifierQuery, { administrationTitreTypeTitreStatut: { - administrationId: 'admin-id', + administrationId: ADMINISTRATION_IDS.BRGM, titreTypeId: 'arm', titreStatutId: 'val', titresModificationInterdit: true, @@ -182,7 +129,7 @@ describe('administrationTitreTypeTitreStatutModifier', () => { administrationTitreTypeTitreStatutModifierQuery, { administrationTitreTypeTitreStatut: { - administrationId: 'admin-id', + administrationId: ADMINISTRATION_IDS.BRGM, titreTypeId: 'arm', titreStatutId: 'val', titresModificationInterdit: true, @@ -196,7 +143,7 @@ describe('administrationTitreTypeTitreStatutModifier', () => { expect(res.body).toMatchObject({ data: { administrationTitreTypeTitreStatutModifier: { - id: 'admin-id', + id: ADMINISTRATION_IDS.BRGM, titresTypesTitresStatuts: [ { titreType: { id: 'arm' }, @@ -218,16 +165,12 @@ describe('administrationTitreTypeEtapeTypeModifier', () => { 'administration-titre-type-etape-type-modifier' ) - beforeEach(async () => { - await administrationsUpsert([administration]) - }) - test("ne peut pas modifier les types de titre / types d'étape d'une administration (anonyme)", async () => { const res = await graphQLCall( administrationTitreTypeEtapeTypeModifierQuery, { administrationTitreTypeEtapeType: { - administrationId: 'admin-id', + administrationId: ADMINISTRATION_IDS.BRGM, titreTypeId: 'arm', etapeTypeId: 'dex', lectureInterdit: true, @@ -245,7 +188,7 @@ describe('administrationTitreTypeEtapeTypeModifier', () => { administrationTitreTypeEtapeTypeModifierQuery, { administrationTitreTypeEtapeType: { - administrationId: 'admin-id', + administrationId: ADMINISTRATION_IDS.BRGM, titreTypeId: 'arm', etapeTypeId: 'dex', lectureInterdit: true, @@ -259,7 +202,7 @@ describe('administrationTitreTypeEtapeTypeModifier', () => { expect(res.body).toMatchObject({ data: { administrationTitreTypeEtapeTypeModifier: { - id: 'admin-id', + id: ADMINISTRATION_IDS.BRGM, titresTypesEtapesTypes: [ { titreType: { id: 'arm' }, diff --git a/packages/api/tests/administrations-permissions-demarches.test.ts b/packages/api/tests/administrations-permissions-demarches.test.ts index a2bafa1a4..18676909c 100644 --- a/packages/api/tests/administrations-permissions-demarches.test.ts +++ b/packages/api/tests/administrations-permissions-demarches.test.ts @@ -7,14 +7,12 @@ import { console.info = jest.fn() console.error = jest.fn() -const knex = dbManager.getKnex() beforeAll(async () => { - await dbManager.populateDb(knex) + await dbManager.populateDb() }) afterAll(async () => { - await dbManager.truncateDb(knex) - await dbManager.closeKnex(knex) + await dbManager.closeKnex() }) describe('Visibilité des démarches', () => { @@ -25,7 +23,7 @@ describe('Visibilité des démarches', () => { ${'min-mtes-dgaln-01'} | ${true} ${'min-dajb-01'} | ${true} `( - "un utilisateur admin de l’administration $administrationId peut voir les démarches d'un titre ARM : $visible", + "un utilisateur admin de l’administration $administrationId peut voir les démarches d'un titre ARM : $visible", async ({ administrationId, visible }) => visibleCheck(administrationId, visible, 'demarches', 'arm', false) ) @@ -38,7 +36,7 @@ describe('Visibilité des démarches', () => { ${'min-mtes-dgaln-01'} | ${true} ${'min-dajb-01'} | ${true} `( - "un utilisateur admin de l’administration $administrationId peut voir les démarches d'un titre AXM : $visible", + "un utilisateur admin de l’administration $administrationId peut voir les démarches d'un titre AXM : $visible", async ({ administrationId, visible }) => visibleCheck(administrationId, visible, 'demarches', 'axm', false) ) @@ -49,7 +47,7 @@ describe('Visibilité des démarches', () => { ${'min-mtes-dgaln-01'} | ${true} ${'min-dajb-01'} | ${true} `( - "un utilisateur admin de l’administration $administrationId peut voir les démarches d'un titre CXM : $visible", + "un utilisateur admin de l’administration $administrationId peut voir les démarches d'un titre CXM : $visible", async ({ administrationId, visible }) => visibleCheck(administrationId, visible, 'demarches', 'cxm', false) ) @@ -60,7 +58,7 @@ describe('Visibilité des démarches', () => { ${'min-mtes-dgaln-01'} | ${true} ${'min-dajb-01'} | ${true} `( - "un utilisateur admin de l’administration $administrationId peut voir les démarches d'un titre PRM : $visible", + "un utilisateur admin de l’administration $administrationId peut voir les démarches d'un titre PRM : $visible", async ({ administrationId, visible }) => visibleCheck(administrationId, visible, 'demarches', 'prm', false) ) @@ -71,7 +69,7 @@ describe('Visibilité des démarches', () => { ${'min-mtes-dgaln-01'} | ${true} ${'min-dajb-01'} | ${true} `( - "un utilisateur admin de l’administration $administrationId peut voir les démarches d'un titre PXM : $visible", + "un utilisateur admin de l’administration $administrationId peut voir les démarches d'un titre PXM : $visible", async ({ administrationId, visible }) => visibleCheck(administrationId, visible, 'demarches', 'pxm', false) ) @@ -84,7 +82,7 @@ describe('Création des démarches', () => { ${'min-mtes-dgaln-01'} | ${true} ${'min-dajb-01'} | ${false} `( - "un utilisateur admin de l’administration $administrationId peut créer des démarches d'un titre ARM : $creer", + "un utilisateur admin de l’administration $administrationId peut créer des démarches d'un titre ARM : $creer", async ({ administrationId, creer }) => creationCheck(administrationId, creer, 'demarches', 'arm') ) @@ -96,7 +94,7 @@ describe('Création des démarches', () => { ${'min-mtes-dgaln-01'} | ${true} ${'min-dajb-01'} | ${false} `( - "un utilisateur admin de l’administration $administrationId peut créer des démarches d'un titre AXM : $creer", + "un utilisateur admin de l’administration $administrationId peut créer des démarches d'un titre AXM : $creer", async ({ administrationId, creer }) => creationCheck(administrationId, creer, 'demarches', 'axm') ) @@ -107,7 +105,7 @@ describe('Création des démarches', () => { ${'min-mtes-dgaln-01'} | ${true} ${'min-dajb-01'} | ${false} `( - "un utilisateur admin de l’administration $administrationId peut créer des démarches d'un titre CXM : $creer", + "un utilisateur admin de l’administration $administrationId peut créer des démarches d'un titre CXM : $creer", async ({ administrationId, creer }) => creationCheck(administrationId, creer, 'demarches', 'cxm') ) @@ -118,7 +116,7 @@ describe('Création des démarches', () => { ${'min-mtes-dgaln-01'} | ${true} ${'min-dajb-01'} | ${false} `( - "un utilisateur admin de l’administration $administrationId peut créer des démarches d'un titre PRM : $creer", + "un utilisateur admin de l’administration $administrationId peut créer des démarches d'un titre PRM : $creer", async ({ administrationId, creer }) => creationCheck(administrationId, creer, 'demarches', 'prm') ) @@ -129,7 +127,7 @@ describe('Création des démarches', () => { ${'min-mtes-dgaln-01'} | ${true} ${'min-dajb-01'} | ${false} `( - "un utilisateur admin de l’administration $administrationId peut créer des démarches d'un titre PXM : $creer", + "un utilisateur admin de l’administration $administrationId peut créer des démarches d'un titre PXM : $creer", async ({ administrationId, creer }) => creationCheck(administrationId, creer, 'demarches', 'pxm') ) @@ -142,7 +140,7 @@ describe('Modification des démarches', () => { ${'min-mtes-dgaln-01'} | ${true} ${'min-dajb-01'} | ${false} `( - "un utilisateur admin de l’administration $administrationId peut modifier des démarches d'un titre ARM : $modifier", + "un utilisateur admin de l’administration $administrationId peut modifier des démarches d'un titre ARM : $modifier", async ({ administrationId, modifier }) => modificationCheck(administrationId, modifier, 'demarches', 'arm') ) @@ -154,7 +152,7 @@ describe('Modification des démarches', () => { ${'min-mtes-dgaln-01'} | ${true} ${'min-dajb-01'} | ${false} `( - "un utilisateur admin de l’administration $administrationId peut modifier des démarches d'un titre AXM : $modifier", + "un utilisateur admin de l’administration $administrationId peut modifier des démarches d'un titre AXM : $modifier", async ({ administrationId, modifier }) => modificationCheck(administrationId, modifier, 'demarches', 'axm') ) @@ -165,7 +163,7 @@ describe('Modification des démarches', () => { ${'min-mtes-dgaln-01'} | ${true} ${'min-dajb-01'} | ${false} `( - "un utilisateur admin de l’administration $administrationId peut modifier des démarches d'un titre CXM : $modifier", + "un utilisateur admin de l’administration $administrationId peut modifier des démarches d'un titre CXM : $modifier", async ({ administrationId, modifier }) => modificationCheck(administrationId, modifier, 'demarches', 'cxm') ) @@ -176,7 +174,7 @@ describe('Modification des démarches', () => { ${'min-mtes-dgaln-01'} | ${true} ${'min-dajb-01'} | ${false} `( - "un utilisateur admin de l’administration $administrationId peut modifier des démarches d'un titre PRM : $modifier", + "un utilisateur admin de l’administration $administrationId peut modifier des démarches d'un titre PRM : $modifier", async ({ administrationId, modifier }) => modificationCheck(administrationId, modifier, 'demarches', 'prm') ) @@ -187,7 +185,7 @@ describe('Modification des démarches', () => { ${'min-mtes-dgaln-01'} | ${true} ${'min-dajb-01'} | ${false} `( - "un utilisateur admin de l’administration $administrationId peut modifier des démarches d'un titre PXM : $modifier", + "un utilisateur admin de l’administration $administrationId peut modifier des démarches d'un titre PXM : $modifier", async ({ administrationId, modifier }) => modificationCheck(administrationId, modifier, 'demarches', 'pxm') ) diff --git a/packages/api/tests/administrations-permissions-etapes.test.ts b/packages/api/tests/administrations-permissions-etapes.test.ts index 814b2a540..782ec9d92 100644 --- a/packages/api/tests/administrations-permissions-etapes.test.ts +++ b/packages/api/tests/administrations-permissions-etapes.test.ts @@ -21,17 +21,15 @@ jest.mock('../src/tools/file-delete', () => ({ })) console.info = jest.fn() console.error = jest.fn() -const knex = dbManager.getKnex() beforeAll(async () => { - await dbManager.populateDb(knex) + await dbManager.populateDb() await TitresTypesDemarchesTypesEtapesTypesJustificatifsTypes.query().delete() await TitresTypesDemarchesTypesEtapesTypesDocumentsTypes.query().delete() }) afterAll(async () => { - await dbManager.truncateDb(knex) - await dbManager.closeKnex(knex) + await dbManager.closeKnex() }) describe('Visibilité des étapes', () => { diff --git a/packages/api/tests/administrations-permissions-titres.test.ts b/packages/api/tests/administrations-permissions-titres.test.ts index d69437277..d66c626a6 100644 --- a/packages/api/tests/administrations-permissions-titres.test.ts +++ b/packages/api/tests/administrations-permissions-titres.test.ts @@ -7,14 +7,12 @@ import { console.info = jest.fn() console.error = jest.fn() -const knex = dbManager.getKnex() beforeAll(async () => { - await dbManager.populateDb(knex) + await dbManager.populateDb() }) afterAll(async () => { - await dbManager.truncateDb(knex) - await dbManager.closeKnex(knex) + await dbManager.closeKnex() }) describe('Visibilité des titres par les administrations gestionnaires ou associées', () => { diff --git a/packages/api/tests/db-manager.ts b/packages/api/tests/db-manager.ts index fbd70e56d..fb44f9a62 100644 --- a/packages/api/tests/db-manager.ts +++ b/packages/api/tests/db-manager.ts @@ -8,13 +8,10 @@ import { knexSnakeCaseMappers, Model } from 'objection' class DbManager { private readonly dbName: string + private knexInstance = null public constructor() { - // jest hack to get a global instance called only once - this.dbName = process.env.DB_NAME - ? process.env.DB_NAME - : `a${idGenerate().toLowerCase()}` - process.env.DB_NAME = this.dbName + this.dbName = `a${idGenerate().toLowerCase()}` } private static getPgUser() { @@ -25,7 +22,7 @@ class DbManager { return process.env.PGPASSWORD ?? 'password' } - public async init(): Promise<void> { + private async init(): Promise<void> { const globalConnection = `postgres://${DbManager.getPgUser()}:${DbManager.getPgPassword()}@localhost/postgres` const globalClient = new Client(globalConnection) await globalClient.connect() @@ -37,13 +34,13 @@ class DbManager { } await globalClient.end() - const knex = this.getKnex() - await knex.migrate.latest() - await DbManager.injectSeed(knex) - await this.closeKnex(knex) + this.knexInstance = this.getKnex() + Model.knex(this.knexInstance) + knexInstanceSet(this.knexInstance) + await this.knexInstance.migrate.latest() } - public getKnex() { + private getKnex() { const knexConfig = { client: 'pg', connection: { @@ -65,26 +62,24 @@ class DbManager { return knex(knexConfig) } - public async populateDb(knex: Knex<any, unknown[]>): Promise<void> { - this.setGlobally(knex) - await DbManager.truncateSchema(knex) - await DbManager.injectSeed(knex) - } + public async populateDb(): Promise<Knex<any, unknown>> { + await this.init() + await this.injectSeed() - public async truncateDb(knex: Knex<any, unknown[]>): Promise<void> { - await DbManager.truncateSchema(knex) + return this.knexInstance } - public async closeKnex(knex: Knex<any, unknown[]>): Promise<void> { - await knex.destroy() + public async reseedDb(): Promise<void> { + await this.truncateSchema() + await this.injectSeed() } - public setGlobally(knex: Knex<any, unknown[]>): void { - Model.knex(knex) - knexInstanceSet(knex) + public async closeKnex(): Promise<void> { + await this.knexInstance.destroy() + await this.end() } - public async end(): Promise<void> { + private async end(): Promise<void> { const globalConnection = 'postgres://postgres:password@localhost/postgres' const globalClient = new Client(globalConnection) await globalClient.connect() @@ -92,17 +87,17 @@ class DbManager { await globalClient.end() } - private static async injectSeed(knex: Knex<any, unknown[]>) { - await knex.transaction(async trx => trx.seed.run()) + private async injectSeed() { + await this.knexInstance.transaction(async trx => trx.seed.run()) } - private static async truncateSchema(knex: Knex<any, unknown[]>) { + private async truncateSchema() { const tables = - (await knex('pg_tables') + (await this.knexInstance('pg_tables') .select('tablename') .where('schemaname', 'public')) ?? [] - await knex.raw( + await this.knexInstance.raw( `TRUNCATE TABLE "${tables .filter(table => table.tablename !== 'knex_migrations') .map(table => table.tablename) diff --git a/packages/api/tests/documents.test.ts b/packages/api/tests/documents.test.ts index d299ade5f..9899fddb6 100644 --- a/packages/api/tests/documents.test.ts +++ b/packages/api/tests/documents.test.ts @@ -13,17 +13,17 @@ import { titreDemarcheCreate } from '../src/database/queries/titres-demarches' console.info = jest.fn() console.error = jest.fn() -const knex = dbManager.getKnex() -beforeEach(async () => { - await dbManager.populateDb(knex) + +beforeAll(async () => { + await dbManager.populateDb() }) afterEach(async () => { - await dbManager.truncateDb(knex) + await dbManager.reseedDb() }) afterAll(async () => { - await dbManager.closeKnex(knex) + await dbManager.closeKnex() }) describe('documentSupprimer', () => { diff --git a/packages/api/tests/entreprises.test.ts b/packages/api/tests/entreprises.test.ts index 4049f8f2a..8701e30a7 100644 --- a/packages/api/tests/entreprises.test.ts +++ b/packages/api/tests/entreprises.test.ts @@ -38,17 +38,16 @@ const entreprisesEtablissementsFetchMock = mocked( entreprisesEtablissementsFetch, true ) -const knex = dbManager.getKnex() -beforeEach(async () => { - await dbManager.populateDb(knex) +beforeAll(async () => { + await dbManager.populateDb() }) afterEach(async () => { - await dbManager.truncateDb(knex) + await dbManager.reseedDb() }) afterAll(async () => { - await dbManager.closeKnex(knex) + await dbManager.closeKnex() }) describe('entrepriseCreer', () => { diff --git a/packages/api/tests/metas.test.ts b/packages/api/tests/metas.test.ts index 603666fcd..a8ae23ddc 100644 --- a/packages/api/tests/metas.test.ts +++ b/packages/api/tests/metas.test.ts @@ -3,14 +3,12 @@ import { graphQLCall, queryImport } from './_utils/index' console.info = jest.fn() console.error = jest.fn() -const knex = dbManager.getKnex() beforeAll(async () => { - await dbManager.populateDb(knex) + await dbManager.populateDb() }) afterAll(async () => { - await dbManager.truncateDb(knex) - await dbManager.closeKnex(knex) + await dbManager.closeKnex() }) describe('statuts', () => { diff --git a/packages/api/tests/queries/administration-modifier.graphql b/packages/api/tests/queries/administration-modifier.graphql deleted file mode 100644 index 6eb2f42a7..000000000 --- a/packages/api/tests/queries/administration-modifier.graphql +++ /dev/null @@ -1,91 +0,0 @@ -mutation AdministrationModifier($administration: InputAdministration!) { - administrationModifier(administration: $administration) { - ...administration - } -} - -fragment administration on Administration { - id - nom - type { - id - nom - } - abreviation - service - adresse1 - adresse2 - codePostal - commune - cedex - url - telephone - email - utilisateurs { - id - nom - } - departement { - id - nom - } - region { - id - nom - } - titresTypes { - id - domaine { - id - nom - } - type { - id - nom - } - gestionnaire - associee - } - titresTypesTitresStatuts { - titreType { - id - domaine { - id - nom - } - type { - id - nom - } - } - titreStatut { - id - nom - couleur - } - titresModificationInterdit - demarchesModificationInterdit - etapesModificationInterdit - } - titresTypesEtapesTypes { - titreType { - id - type { - id - nom - } - domaine { - id - nom - } - } - etapeType { - id - nom - } - lectureInterdit - creationInterdit - modificationInterdit - } - modification -} diff --git a/packages/api/tests/setup.ts b/packages/api/tests/setup.ts index 7bf4d93e9..4f00a626e 100644 --- a/packages/api/tests/setup.ts +++ b/packages/api/tests/setup.ts @@ -1,10 +1,8 @@ import 'dotenv/config' -import { dbManager } from './db-manager' import { mailjet } from '../src/tools/api-mailjet' export default async () => { // https://github.com/mailjet/mailjet-apiv3-nodejs#disable-api-call mailjet.post('send', { version: 'v3.1', perform_api_call: false }) - await dbManager.init() } diff --git a/packages/api/tests/teardown.ts b/packages/api/tests/teardown.ts deleted file mode 100644 index e4ddd656e..000000000 --- a/packages/api/tests/teardown.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { dbManager } from './db-manager' - -export default async () => { - await dbManager.end() -} diff --git a/packages/api/tests/titres-demarches.test.ts b/packages/api/tests/titres-demarches.test.ts index 84bd4043f..3b7b8f900 100644 --- a/packages/api/tests/titres-demarches.test.ts +++ b/packages/api/tests/titres-demarches.test.ts @@ -7,17 +7,16 @@ import { userSuper } from '../src/database/user-super' console.info = jest.fn() console.error = jest.fn() -const knex = dbManager.getKnex() -beforeEach(async () => { - await dbManager.populateDb(knex) +beforeAll(async () => { + await dbManager.populateDb() }) afterEach(async () => { - await dbManager.truncateDb(knex) + await dbManager.reseedDb() }) afterAll(async () => { - await dbManager.closeKnex(knex) + await dbManager.closeKnex() }) describe('demarcheCreer', () => { diff --git a/packages/api/tests/titres-etapes-creer.test.ts b/packages/api/tests/titres-etapes-creer.test.ts index 0225687e7..e72cbe62d 100644 --- a/packages/api/tests/titres-etapes-creer.test.ts +++ b/packages/api/tests/titres-etapes-creer.test.ts @@ -25,9 +25,8 @@ jest.mock('../src/tools/file-delete', () => ({ })) console.info = jest.fn() console.error = jest.fn() -const knex = dbManager.getKnex() beforeAll(async () => { - await dbManager.populateDb(knex) + await dbManager.populateDb() await TitresTypesDemarchesTypesEtapesTypesJustificatifsTypes.query().delete() await TitresTypesDemarchesTypesEtapesTypesDocumentsTypes.query().delete() @@ -48,8 +47,7 @@ beforeEach(async () => { }) afterAll(async () => { - await dbManager.truncateDb(knex) - await dbManager.closeKnex(knex) + await dbManager.closeKnex() }) const demarcheCreate = async () => { diff --git a/packages/api/tests/titres-etapes-modifier.test.ts b/packages/api/tests/titres-etapes-modifier.test.ts index dec29f7b0..128eca104 100644 --- a/packages/api/tests/titres-etapes-modifier.test.ts +++ b/packages/api/tests/titres-etapes-modifier.test.ts @@ -26,9 +26,8 @@ jest.mock('../src/tools/file-delete', () => ({ console.info = jest.fn() console.error = jest.fn() -const knex = dbManager.getKnex() beforeAll(async () => { - await dbManager.populateDb(knex) + await dbManager.populateDb() }) beforeEach(async () => { @@ -36,8 +35,7 @@ beforeEach(async () => { }) afterAll(async () => { - await dbManager.truncateDb(knex) - await dbManager.closeKnex(knex) + await dbManager.closeKnex() }) async function etapeCreate() { diff --git a/packages/api/tests/titres.test.ts b/packages/api/tests/titres.test.ts index 2f3579f2f..cb9833ad5 100644 --- a/packages/api/tests/titres.test.ts +++ b/packages/api/tests/titres.test.ts @@ -13,17 +13,16 @@ import { titreCreate } from '../src/database/queries/titres' console.info = jest.fn() console.error = jest.fn() -const knex = dbManager.getKnex() -beforeEach(async () => { - await dbManager.populateDb(knex) +beforeAll(async () => { + await dbManager.populateDb() }) afterEach(async () => { - await dbManager.truncateDb(knex) + await dbManager.reseedDb() }) afterAll(async () => { - await dbManager.closeKnex(knex) + await dbManager.closeKnex() }) describe('titre', () => { diff --git a/packages/api/tests/token.test.ts b/packages/api/tests/token.test.ts index db365a8c2..66fc9ccf7 100644 --- a/packages/api/tests/token.test.ts +++ b/packages/api/tests/token.test.ts @@ -4,14 +4,12 @@ import Utilisateurs from '../src/database/models/utilisateurs' console.info = jest.fn() console.error = jest.fn() -const knex = dbManager.getKnex() beforeAll(async () => { - await dbManager.populateDb(knex) + await dbManager.populateDb() }) afterAll(async () => { - await dbManager.truncateDb(knex) - await dbManager.closeKnex(knex) + await dbManager.closeKnex() }) describe('utilisateurConnecter', () => { diff --git a/packages/api/tests/upload.test.ts b/packages/api/tests/upload.test.ts index 2b3814043..6a5d5db3c 100644 --- a/packages/api/tests/upload.test.ts +++ b/packages/api/tests/upload.test.ts @@ -4,15 +4,13 @@ import { dbManager } from './db-manager' jest.mock('tus-node-server') console.info = jest.fn() -const knex = dbManager.getKnex() describe('téléversement de fichier par rest (tus)', () => { beforeAll(async () => { - await dbManager.populateDb(knex) + await dbManager.populateDb() }) afterAll(async () => { - await dbManager.truncateDb(knex) - await dbManager.closeKnex(knex) + await dbManager.closeKnex() }) describe('permission de téléverser', () => { diff --git a/packages/api/tests/utilisateurs.test.ts b/packages/api/tests/utilisateurs.test.ts index 94c9d8a2a..6e2c49280 100644 --- a/packages/api/tests/utilisateurs.test.ts +++ b/packages/api/tests/utilisateurs.test.ts @@ -5,20 +5,21 @@ import request from 'supertest' import jwt from 'jsonwebtoken' import { dbManager } from './db-manager' import { IUtilisateur } from '../src/types' +import { Administrations } from 'camino-common/src/administrations' console.info = jest.fn() console.error = jest.fn() -const knex = dbManager.getKnex() -beforeEach(async () => { - await dbManager.populateDb(knex) +let knex +beforeAll(async () => { + knex = await dbManager.populateDb() }) afterEach(async () => { - await dbManager.truncateDb(knex) + await dbManager.reseedDb() }) afterAll(async () => { - await dbManager.closeKnex(knex) + await dbManager.closeKnex() }) describe('utilisateurModifier', () => { @@ -232,18 +233,7 @@ describe('utilisateursCreer', () => { }) test("en tant qu'admin', peut être associé à une administrations", async () => { - await knex('administrations_types').insert({ - id: 'adm', - nom: 'admin', - ordre: 1 - }) - - await knex('administrations').insert({ - id: 'administration', - nom: 'admin', - typeId: 'adm' - }) - + const administration = Administrations['aut-97300-01'] const res = await graphQLCall( utilisateurCreerQuery, { @@ -253,7 +243,7 @@ describe('utilisateursCreer', () => { email: 'test@camino.local', motDePasse: 'mot-de-passe', permissionId: 'admin', - administrations: [{ id: 'administration' }] + administrations: [{ id: administration.id }] } }, 'super' diff --git a/packages/api/tsconfig.json b/packages/api/tsconfig.json index 35c3065f9..344fbb1b7 100644 --- a/packages/api/tsconfig.json +++ b/packages/api/tsconfig.json @@ -13,7 +13,6 @@ "noImplicitReturns": true, "noImplicitThis": true, "outDir": "dist", - "rootDir": ".", "strict": true, "strictNullChecks": true, "sourceMap": true, diff --git a/packages/common/src/administrations.test.ts b/packages/common/src/administrations.test.ts new file mode 100644 index 000000000..c60649953 --- /dev/null +++ b/packages/common/src/administrations.test.ts @@ -0,0 +1,6 @@ +import test from 'ava' +import { sortedAdministrationTypes } from './administrations' + +test('sortedAdministrationTypes', t => { + t.snapshot(sortedAdministrationTypes) +}) diff --git a/packages/common/src/administrations.test.ts.md b/packages/common/src/administrations.test.ts.md new file mode 100644 index 000000000..e54f19ad1 --- /dev/null +++ b/packages/common/src/administrations.test.ts.md @@ -0,0 +1,42 @@ +# Snapshot report for `src/administrations.test.ts` + +The actual snapshot is saved in `administrations.test.ts.snap`. + +Generated by [AVA](https://avajs.dev). + +## sortedAdministrationTypes + +> Snapshot 1 + + [ + { + id: 'min', + nom: 'Ministère', + ordre: 1, + }, + { + id: 'dre', + nom: 'Dréal', + ordre: 2, + }, + { + id: 'dea', + nom: 'Déal', + ordre: 3, + }, + { + id: 'pre', + nom: 'Préfecture', + ordre: 4, + }, + { + id: 'ope', + nom: 'Opérateur', + ordre: 5, + }, + { + id: 'aut', + nom: 'Autorité', + ordre: 6, + }, + ] diff --git a/packages/common/src/administrations.test.ts.snap b/packages/common/src/administrations.test.ts.snap new file mode 100644 index 0000000000000000000000000000000000000000..cb5ce1fcb74081bdda2efb8b7b344b671b1246e6 GIT binary patch literal 445 zcmZ<^b5sb<ODrhP$S+YSGv;DukX+LGhwrRVBgb?mzaMMfmp@Gikvq^a>EsQzZMn+| z&*;i`b1;AbbL-^&UWXkRjulV0U#okoOZJOw%-k3qG4ovZ>5rzEh4<tZzkJFh#!^`H zg*E1u>uyU+?t>RkroVXdMEXbUmPMQ~O!n`rKRvd4r#F+gO8K6=n|ZNXt!2`5YeDfz zmA?6J*y~hUwQJ?(_&JOH41Cab(Q^95vu8fXye!krl2UcHUE<@#F46D6KBtj!MuYYS z*EzmP=B)+GTh;`v4KwyQs?g`Ss^w0de#@6NZj+8J?K0`*ZOT~oF~C*3*U2^dYqaqZ z_77ZkC;XRReiyr8pUM~WYp=hC=m#IZ!La*5OInHXa{h%r2V^Twy$bWIZ~nw*cW~Rx zi*M)bV^5VYIanH2Ui8a$ie&}k={0e`)~{c_JgnJST5I8)U-z_T?Ra)3+W5ia&~-A) z;~hU~L>$|+^8<@_`m|kZnxyo%AGj~ITy;{b^`+1YkGP&?X}t*xY>vDkkYyhDHbIzK zrh1LN&gu>A?YriAS^J3n(2vw9F)d5%mG<^M8)ZB#=7&+_i>NvJwyPv(JF+k^0044L B$sPaz literal 0 HcmV?d00001 diff --git a/packages/common/src/administrations.ts b/packages/common/src/administrations.ts new file mode 100644 index 000000000..0f7ab5520 --- /dev/null +++ b/packages/common/src/administrations.ts @@ -0,0 +1,1939 @@ +import { Definition } from './definition' +import { RegionId } from './region' +import { DepartementId } from './departement' + +export const ADMINISTRATION_TYPE_IDS = { + AUTORITE: 'aut', + DEAL: 'dea', + DREAL: 'dre', + MINISTERE: 'min', + OPERATEUR: 'ope', + PREFECTURE: 'pre' +} as const + +export type AdministrationTypeId = + typeof ADMINISTRATION_TYPE_IDS[keyof typeof ADMINISTRATION_TYPE_IDS] + +export type AdministrationType<T = AdministrationTypeId> = Omit< + Definition<T>, + 'description' +> +export const ADMINISTRATION_TYPES: { + [key in AdministrationTypeId]: AdministrationType<key> +} = { + aut: { + id: 'aut', + nom: 'Autorité', + ordre: 6 + }, + dea: { + id: 'dea', + nom: 'Déal', + ordre: 3 + }, + dre: { + id: 'dre', + nom: 'Dréal', + ordre: 2 + }, + min: { + id: 'min', + nom: 'Ministère', + ordre: 1 + }, + ope: { + id: 'ope', + nom: 'Opérateur', + ordre: 5 + }, + pre: { + id: 'pre', + nom: 'Préfecture', + ordre: 4 + } +} + +export const sortedAdministrationTypes = Object.values( + ADMINISTRATION_TYPES +).sort((a, b) => a.ordre - b.ordre) + +export const ADMINISTRATION_IDS = { + 'GENDARMERIE NATIONALE - GUYANE': 'aut-97300-01', + 'MRAE GUYANE': 'aut-mrae-guyane-01', + 'DEAL - GUADELOUPE': 'dea-guadeloupe-01', + 'DGTM - GUYANE': 'dea-guyane-01', + 'DEAL - MARTINIQUE': 'dea-martinique-01', + 'DEAL - MAYOTTE': 'dea-mayotte-01', + 'DEAL - LA RÉUNION': 'dea-reunion-01', + 'DREAL - AUVERGNE-RHÔNE-ALPES - SIÈGE DE LYON': 'dre-aura-01', + 'DREAL - BOURGOGNE-FRANCHE-COMTÉ - SIÈGE DE BESANÇON': 'dre-bfc-01', + 'DREAL - BRETAGNE': 'dre-bretagne-01', + 'DREAL - CENTRE-VAL-DE-LOIRE': 'dre-centre-val-de-loire-01', + 'DREAL - CORSE': 'dre-corse-01', + 'DREAL - GRAND EST - SIÈGE DE METZ': 'dre-grand-est-01', + 'DREAL - HAUTS-DE-FRANCE - SIÈGE DE LILLE': 'dre-hauts-de-france-01', + 'DRIEE - ÎLE-DE-FRANCE': 'dre-ile-de-france-01', + 'DREAL - NORMANDIE - SIÈGE DE ROUEN': 'dre-normandie-01', + 'DREAL - NOUVELLE-AQUITAINE - SIÈGE DE POITIERS': 'dre-nouvelle-aquitaine-01', + 'DREAL - OCCITANIE - SIÈGE DE TOULOUSE': 'dre-occitanie-01', + "DREAL - PROVENCE-ALPES-CÔTE-D'AZUR": 'dre-paca-01', + 'DREAL - PAYS DE LA LOIRE': 'dre-pays-de-la-loire-01', + "DAJ - MINISTÈRE DE L'ECONOMIE, DES FINANCES ET DE LA RELANCE": 'min-dajb-01', + 'DGCL/SDFLAE/FL1': 'min-mctrct-dgcl-01', + 'DGALN/DEB/EARM2': 'min-mtes-dgaln-01', + 'DGEC/DE/SD2/2A': 'min-mtes-dgec-01', + 'DGPR/SRT/SDRCP/BSSS': 'min-mtes-dgpr-01', + BRGM: 'ope-brgm-01', + 'BRGM - PROJET ZERCOA': 'ope-brgm-02', + CACEM: 'ope-cacem-01', + 'OFFICE NATIONAL DES FORÊTS': 'ope-onf-973-01', + 'PÔLE TECHNIQUE MINIER DE GUYANE': 'ope-ptmg-973-01', + 'PRÉFECTURE - AIN': 'pre-01053-01', + 'PRÉFECTURE - AISNE': 'pre-02408-01', + 'PRÉFECTURE - ALLIER': 'pre-03190-01', + 'PRÉFECTURE - ALPES-DE-HAUTE-PROVENCE': 'pre-04070-01', + 'PRÉFECTURE - HAUTES-ALPES': 'pre-05061-01', + 'PRÉFECTURE - ALPES-MARITIMES': 'pre-06088-01', + 'PRÉFECTURE - ARDÈCHE': 'pre-07186-01', + 'PRÉFECTURE - ARDENNES': 'pre-08105-01', + 'PRÉFECTURE - ARIÈGE': 'pre-09122-01', + 'PRÉFECTURE - AUBE': 'pre-10387-01', + 'PRÉFECTURE - AUDE': 'pre-11069-01', + 'PRÉFECTURE - AVEYRON': 'pre-12202-01', + 'PRÉFECTURE - BOUCHES-DU-RHÔNE': 'pre-13203-01', + 'PRÉFECTURE - CALVADOS': 'pre-14118-01', + 'PRÉFECTURE - CANTAL': 'pre-15014-01', + 'PRÉFECTURE - CHARENTE': 'pre-16015-01', + 'PRÉFECTURE - CHARENTE-MARITIME': 'pre-17300-01', + 'PRÉFECTURE - CHER': 'pre-18033-01', + 'PRÉFECTURE - CORRÈZE': 'pre-19272-01', + "PRÉFECTURE - CÔTE-D'OR": 'pre-21231-01', + "PRÉFECTURE - CÔTES-D'ARMOR": 'pre-22278-01', + 'PRÉFECTURE - CREUSE': 'pre-23096-01', + 'PRÉFECTURE - DORDOGNE': 'pre-24322-01', + 'PRÉFECTURE - DOUBS': 'pre-25056-01', + 'PRÉFECTURE - DRÔME': 'pre-26362-01', + 'PRÉFECTURE - EURE': 'pre-27229-01', + 'PRÉFECTURE - EURE-ET-LOIR': 'pre-28085-01', + 'PRÉFECTURE - FINISTÈRE': 'pre-29232-01', + 'PRÉFECTURE - CORSE-DU-SUD': 'pre-2A004-01', + 'PRÉFECTURE - HAUTE-CORSE': 'pre-2B033-01', + 'PRÉFECTURE - GARD': 'pre-30189-01', + 'PRÉFECTURE - HAUTE-GARONNE': 'pre-31555-01', + 'PRÉFECTURE - GERS': 'pre-32013-01', + 'PRÉFECTURE - GIRONDE': 'pre-33063-01', + 'PRÉFECTURE - HÉRAULT': 'pre-34172-01', + 'PRÉFECTURE - ILLE-ET-VILAINE': 'pre-35238-01', + 'PRÉFECTURE - INDRE': 'pre-36044-01', + 'PRÉFECTURE - INDRE-ET-LOIRE': 'pre-37261-01', + 'PRÉFECTURE - ISÈRE': 'pre-38185-01', + 'PRÉFECTURE - JURA': 'pre-39300-01', + 'PRÉFECTURE - LANDES': 'pre-40192-01', + 'PRÉFECTURE - LOIR-ET-CHER': 'pre-41018-01', + 'PRÉFECTURE - LOIRE': 'pre-42218-01', + 'PRÉFECTURE - HAUTE-LOIRE': 'pre-43157-01', + 'PRÉFECTURE - LOIRE-ATLANTIQUE': 'pre-44109-01', + 'PRÉFECTURE - LOIRET': 'pre-45234-01', + 'PRÉFECTURE - LOT': 'pre-46042-01', + 'PRÉFECTURE - LOT-ET-GARONNE': 'pre-47001-01', + 'PRÉFECTURE - LOZÈRE': 'pre-48095-01', + 'PRÉFECTURE - MAINE-ET-LOIRE': 'pre-49007-01', + 'PRÉFECTURE - MANCHE': 'pre-50502-01', + 'PRÉFECTURE - MARNE': 'pre-51108-01', + 'PRÉFECTURE - HAUTE-MARNE': 'pre-52121-01', + 'PRÉFECTURE - MAYENNE': 'pre-53130-01', + 'PRÉFECTURE - MEURTHE-ET-MOSELLE': 'pre-54395-01', + 'PRÉFECTURE - MEUSE': 'pre-55029-01', + 'PRÉFECTURE - MORBIHAN': 'pre-56260-01', + 'PRÉFECTURE - MOSELLE': 'pre-57463-01', + 'PRÉFECTURE - NIÈVRE': 'pre-58194-01', + 'PRÉFECTURE - NORD': 'pre-59350-01', + 'PRÉFECTURE - OISE': 'pre-60057-01', + 'PRÉFECTURE - ORNE': 'pre-61001-01', + 'PRÉFECTURE - PAS-DE-CALAIS': 'pre-62041-01', + 'PRÉFECTURE - PUY-DE-DÔME': 'pre-63113-01', + 'PRÉFECTURE - PYRÉNÉES-ATLANTIQUES': 'pre-64445-01', + 'PRÉFECTURE - HAUTES-PYRÉNÉES': 'pre-65440-01', + 'PRÉFECTURE - PYRÉNÉES-ORIENTALES': 'pre-66136-01', + 'PRÉFECTURE - BAS-RHIN': 'pre-67482-01', + 'PRÉFECTURE - HAUT-RHIN': 'pre-68066-01', + 'PRÉFECTURE - RHÔNE': 'pre-69383-01', + 'PRÉFECTURE - HAUTE-SAÔNE': 'pre-70550-01', + 'PRÉFECTURE - SAÔNE-ET-LOIRE': 'pre-71270-01', + 'PRÉFECTURE - SARTHE': 'pre-72181-01', + 'PRÉFECTURE - SAVOIE': 'pre-73065-01', + 'PRÉFECTURE - HAUTE-SAVOIE': 'pre-74010-01', + 'PRÉFECTURE - ÎLE-DE-FRANCE': 'pre-75104-01', + 'PRÉFECTURE - SEINE-MARITIME': 'pre-76540-01', + 'PRÉFECTURE - SEINE-ET-MARNE': 'pre-77288-01', + 'PRÉFECTURE - YVELINES': 'pre-78646-01', + 'PRÉFECTURE - DEUX-SÈVRES': 'pre-79191-01', + 'PRÉFECTURE - SOMME': 'pre-80021-01', + 'PRÉFECTURE - TARN': 'pre-81004-01', + 'PRÉFECTURE - TARN-ET-GARONNE': 'pre-82121-01', + 'PRÉFECTURE - VAR': 'pre-83137-01', + 'PRÉFECTURE - VAUCLUSE': 'pre-84007-01', + 'PRÉFECTURE - VENDÉE': 'pre-85191-01', + 'PRÉFECTURE - VIENNE': 'pre-86194-01', + 'PRÉFECTURE - HAUTE-VIENNE': 'pre-87085-01', + 'PRÉFECTURE - VOSGES': 'pre-88160-01', + 'PRÉFECTURE - YONNE': 'pre-89024-01', + 'PRÉFECTURE - TERRITOIRE DE BELFORT': 'pre-90010-01', + 'PRÉFECTURE - ESSONNE': 'pre-91228-01', + 'PRÉFECTURE - HAUTS-DE-SEINE': 'pre-92050-01', + 'PRÉFECTURE - SEINE-SAINT-DENIS': 'pre-93008-01', + 'PRÉFECTURE - VAL-DE-MARNE': 'pre-94028-01', + "PRÉFECTURE - VAL-D'OISE": 'pre-95127-01', + 'PRÉFECTURE - GUADELOUPE': 'pre-97105-01', + 'PRÉFECTURE - MARTINIQUE': 'pre-97209-01', + 'PRÉFECTURE - GUYANE': 'pre-97302-01', + 'PRÉFECTURE - RÉUNION': 'pre-97411-01', + 'PRÉFECTURE - MAYOTTE': 'pre-97611-01' +} as const + +export type AdministrationId = + typeof ADMINISTRATION_IDS[keyof typeof ADMINISTRATION_IDS] + +export interface Administration<T = AdministrationId> { + id: T + typeId: AdministrationTypeId + nom: string + abreviation: string + service?: string + url?: string + email?: string + telephone?: string + adresse1: string + adresse2?: string + codePostal: string + commune: string + cedex?: string + regionId?: RegionId + departementId?: DepartementId +} + +export const Administrations: { + [key in AdministrationId]: Administration<key> +} = + // ----- ne pas supprimer cette ligne : début + { + 'aut-97300-01': { + id: 'aut-97300-01', + typeId: 'aut', + nom: 'Gendarmerie Nationale - Guyane', + abreviation: 'Gendarmerie Nationale - Guyane', + service: 'Centre de conduite des Opérations', + url: 'https://www.gendarmerie.interieur.gouv.fr/', + email: 'cco.comgendgf@gendarmerie.interieur.gouv.fr', + telephone: '+594 29 28 00', + adresse1: 'Caserne La Madeleine', + adresse2: '1296 Route de la Madeleine', + codePostal: '97300', + commune: 'Cayenne' + }, + 'aut-mrae-guyane-01': { + id: 'aut-mrae-guyane-01', + typeId: 'aut', + nom: 'Mission régionale autorité environnementale de Guyane', + abreviation: 'MRAE Guyane', + url: 'http://www.mrae.developpement-durable.gouv.fr/guyane-r27.html', + telephone: '+594 (0)5 94 39 80 00', + adresse1: 'Route du Vieux-Port\n97300 Cayenne', + adresse2: 'Adresse postale\nRoute du Vieux-Port\nCS 76003\n97306 Cayenne', + codePostal: '97300', + commune: 'Cayenne', + cedex: 'Cedex', + regionId: '03' + }, + 'dea-guadeloupe-01': { + id: 'dea-guadeloupe-01', + typeId: 'dea', + nom: "Direction de l'environnement de l'aménagement et du logement (DEAL) - Guadeloupe", + abreviation: 'DEAL - Guadeloupe', + url: 'http://www.guadeloupe.developpement-durable.gouv.fr', + email: 'deal-guadeloupe@developpement-durable.gouv.fr', + telephone: '+33 (0)5 90 99 46 46', + adresse1: 'Route de St Phy\n97102 Basse-Terre', + adresse2: 'Adresse postale\r\nDEAL Guadeloupe\nBP 54\n97102 Basse-Terre', + codePostal: '97102', + commune: 'Basse-Terre', + cedex: 'Cedex', + regionId: '01' + }, + 'dea-guyane-01': { + id: 'dea-guyane-01', + typeId: 'dea', + nom: 'Direction Générale des Territoires et de la Mer de Guyane', + abreviation: 'DGTM - Guyane', + url: 'http://www.guyane.developpement-durable.gouv.fr', + telephone: '+594 5 94 39 80 00', + adresse1: 'Route du Vieux-Port\n97300 Cayenne', + adresse2: 'Adresse postale\nRoute du Vieux-Port\nCS 76003\n97306 Cayenne', + codePostal: '97300', + commune: 'Cayenne', + cedex: 'Cedex', + regionId: '03' + }, + 'dea-martinique-01': { + id: 'dea-martinique-01', + typeId: 'dea', + nom: "Direction de l'environnement de l'aménagement et du logement (DEAL) - Martinique", + abreviation: 'DEAL - Martinique', + url: 'http://www.martinique.developpement-durable.gouv.fr', + email: 'deal-martinique-usagers@developpement-durable.gouv.fr', + telephone: '+33 (0)5 96 59 57 00', + adresse1: 'B.P. 7212\n97274 Schœlcher', + codePostal: '97274', + commune: 'Schœlcher', + cedex: 'Cedex', + regionId: '02' + }, + 'dea-mayotte-01': { + id: 'dea-mayotte-01', + typeId: 'dea', + nom: "Direction de l'environnement de l'aménagement et du logement (DEAL) - Mayotte", + abreviation: 'DEAL - Mayotte', + url: 'http://www.mayotte.gouv.fr/Services-de-l-Etat/Direction-de-l-Environnement-de-l-Amenagement-et-du-Logement-DEAL', + email: 'de-mayotte@equipement.gouv.fr', + telephone: '+262 269 61 12 54', + adresse1: "Terre plein de M'Tsapéré\n97600 Mamoudzou", + adresse2: 'Adresse postale\nBP 109\n97600 Mamoudzou', + codePostal: '97600', + commune: 'Mamoudzou', + cedex: 'Cedex', + regionId: '06' + }, + 'dea-reunion-01': { + id: 'dea-reunion-01', + typeId: 'dea', + nom: "Direction de l'environnement de l'aménagement et du logement (DEAL) - La Réunion", + abreviation: 'DEAL - La Réunion', + url: 'http://www.reunion.developpement-durable.gouv.fr', + email: 'deal-reunion@developpement-durable.gouv.fr', + telephone: '+33 (0)2 62 40 26 26', + adresse1: '2 rue Juliette Dodu\nCS 41009\r\n97743 Saint-Denis', + codePostal: '97743', + commune: 'Saint-Denis', + cedex: 'Cedex', + regionId: '04' + }, + 'dre-aura-01': { + id: 'dre-aura-01', + typeId: 'dre', + nom: "Direction régionale de l'environnement, de l'aménagement et du logement (DREAL) - Auvergne-Rhône-Alpes - Siège de Lyon", + abreviation: 'DREAL - Auvergne-Rhône-Alpes - Siège de Lyon', + url: 'http://www.auvergne-rhone-alpes.developpement-durable.gouv.fr', + email: 'dir.dreal-auvergne-rhone-alpes@developpement-durable.gouv.fr', + telephone: '+33 (0)4 26 28 60 00', + adresse1: '5 place Jules-Ferry\n69006 Lyon', + adresse2: 'Adresse postale\nDreal Rhône-Alpes\n69453 Lyon Cedex 6', + codePostal: '69006', + commune: 'Lyon', + cedex: 'Cedex', + regionId: '84' + }, + 'dre-bfc-01': { + id: 'dre-bfc-01', + typeId: 'dre', + nom: "Direction régionale de l'environnement, de l'aménagement et du logement (DREAL) - Bourgogne-Franche-Comté - Siège de Besançon", + abreviation: 'DREAL - Bourgogne-Franche-Comté - Siège de Besançon', + url: 'http://www.bourgogne-franche-comte.developpement-durable.gouv.fr', + telephone: '+33 (0)3 39 59 62 00', + adresse1: '5 voie Gisèle Halimi', + adresse2: 'BP 31269 ', + codePostal: '25005', + commune: 'Besançon', + cedex: 'Cedex', + regionId: '27' + }, + 'dre-bretagne-01': { + id: 'dre-bretagne-01', + typeId: 'dre', + nom: "Direction régionale de l'environnement, de l'aménagement et du logement (DREAL) - Bretagne", + abreviation: 'DREAL - Bretagne', + url: 'http://www.bretagne.developpement-durable.gouv.fr', + email: 'dreal-bretagne@developpement-durable.gouv.fr', + telephone: '+33 (0)2 99 33 45 55', + adresse1: '10 rue Maurice-Fabre\nCS 96515\n35065 Rennes', + codePostal: '35065', + commune: 'Rennes', + cedex: 'Cedex', + regionId: '53' + }, + 'dre-centre-val-de-loire-01': { + id: 'dre-centre-val-de-loire-01', + typeId: 'dre', + nom: "Direction régionale de l'environnement, de l'aménagement et du logement (DREAL) - Centre-Val-de-Loire", + abreviation: 'DREAL - Centre-Val-de-Loire', + url: 'http://www.centre.developpement-durable.gouv.fr', + email: 'dreal-centre@developpement-durable.gouv.fr', + telephone: '+33 (0)2 36 17 41 41', + adresse1: '5 avenue Buffon\nCS 96407\n45064 Orléans', + codePostal: '45064', + commune: 'Orléans', + cedex: 'Cedex', + regionId: '24' + }, + 'dre-corse-01': { + id: 'dre-corse-01', + typeId: 'dre', + nom: "Direction régionale de l'environnement, de l'aménagement et du logement (DREAL) - Corse", + abreviation: 'DREAL - Corse', + url: 'http://www.corse.developpement-durable.gouv.fr', + email: 'dreal-corse@developpement-durable.gouv.fr', + telephone: '+33 (0)4 95 51 79 70', + adresse1: '19 cours Napoléon\nBâtiment D\nCS 10006\n20704 Ajaccio', + codePostal: '20704', + commune: 'Ajaccio', + cedex: 'Cedex', + regionId: '94' + }, + 'dre-grand-est-01': { + id: 'dre-grand-est-01', + typeId: 'dre', + nom: "Direction régionale de l'environnement, de l'aménagement et du logement (DREAL) - Grand Est - Siège de Metz", + abreviation: 'DREAL - Grand Est - Siège de Metz', + url: 'http://www.grand-est.developpement-durable.gouv.fr', + telephone: '+33 (0)3 87 62 81 00', + adresse1: 'Greenpark\n2 rue Augustin-Fresnel\nBP 95038\n57071 Metz', + codePostal: '57071', + commune: 'Metz', + cedex: 'Cedex', + regionId: '44' + }, + 'dre-hauts-de-france-01': { + id: 'dre-hauts-de-france-01', + typeId: 'dre', + nom: "Direction régionale de l'environnement, de l'aménagement et du logement (DREAL) - Hauts-de-France - Siège de Lille", + abreviation: 'DREAL - Hauts-de-France - Siège de Lille', + url: 'http://www.hauts-de-france.developpement-durable.gouv.fr', + telephone: '+33 (0)3 20 13 48 48', + adresse1: '44 rue de Tournai\nCS 40259\n59019 Lille', + codePostal: '59019', + commune: 'Lille', + cedex: 'Cedex', + regionId: '32' + }, + 'dre-ile-de-france-01': { + id: 'dre-ile-de-france-01', + typeId: 'dre', + nom: "Direction régionale et interdépartementale de l'environnement et de l'énergie (DRIEE) - Île-de-France", + abreviation: 'DRIEE - Île-de-France', + url: 'http://www.driee.ile-de-france.developpement-durable.gouv.fr', + email: 'driee-if@developpement-durable.gouv.fr', + telephone: '+33 (0)1 87 36 45 00', + adresse1: '12 cours Louis Lumière, CS 70027', + codePostal: '94307', + commune: 'Vincennes', + cedex: 'cedex', + regionId: '11' + }, + 'dre-normandie-01': { + id: 'dre-normandie-01', + typeId: 'dre', + nom: "Direction régionale de l'environnement, de l'aménagement et du logement (DREAL) - Normandie - Siège de Rouen", + abreviation: 'DREAL - Normandie - Siège de Rouen', + url: 'http://www.normandie.developpement-durable.gouv.fr', + email: 'dreal-hnormandie@developpement-durable.gouv.fr', + telephone: '+33 (0)2 35 58 53 27', + adresse1: 'BP 86002\nCité administrative\n2 rue Saint-Sever\n76032 Rouen', + codePostal: '76032', + commune: 'Rouen', + cedex: 'Cedex', + regionId: '28' + }, + 'dre-nouvelle-aquitaine-01': { + id: 'dre-nouvelle-aquitaine-01', + typeId: 'dre', + nom: "Direction régionale de l'environnement, de l'aménagement et du logement (DREAL) - Nouvelle-Aquitaine - Siège de Poitiers", + abreviation: 'DREAL - Nouvelle-Aquitaine - Siège de Poitiers', + url: 'http://www.nouvelle-aquitaine.developpement-durable.gouv.fr', + telephone: '+33 (0)5 49 55 63 63', + adresse1: '15 rue Arthur-Ranc\nBP 60539\n86020 Poitiers', + codePostal: '86020', + commune: 'Poitiers', + cedex: 'Cedex', + regionId: '75' + }, + 'dre-occitanie-01': { + id: 'dre-occitanie-01', + typeId: 'dre', + nom: "Direction régionale de l'environnement, de l'aménagement et du logement (DREAL) - Occitanie - Siège de Toulouse", + abreviation: 'DREAL - Occitanie - Siège de Toulouse', + url: 'http://www.occitanie.developpement-durable.gouv.fr', + telephone: '+33 (0)5 61 58 50 00', + adresse1: + '1 rue de la Cité-Administrative\nBâtiment G\nCS 80002\n31074 Toulouse', + codePostal: '31074', + commune: 'Toulouse', + cedex: 'Cedex', + regionId: '76' + }, + 'dre-paca-01': { + id: 'dre-paca-01', + typeId: 'dre', + nom: "Direction régionale de l'environnement, de l'aménagement et du logement (DREAL) - Provence-Alpes-Côte-d'Azur", + abreviation: "DREAL - Provence-Alpes-Côte-d'Azur", + url: 'http://www.paca.developpement-durable.gouv.fr', + telephone: '+33 (0)4 91 28 40 40', + adresse1: '16 rue Antoine-Zattara\nCS 70248\n13331 Marseille', + codePostal: '13331', + commune: 'Marseille', + cedex: 'Cedex', + regionId: '93' + }, + 'dre-pays-de-la-loire-01': { + id: 'dre-pays-de-la-loire-01', + typeId: 'dre', + nom: "Direction régionale de l'environnement, de l'aménagement et du logement (DREAL) - Pays de la Loire", + abreviation: 'DREAL - Pays de la Loire', + url: 'http://www.pays-de-la-loire.developpement-durable.gouv.fr', + email: 'dreal-pays-de-la-loire@developpement-durable.gouv.fr', + telephone: '+33 (0)2 72 74 73 00', + adresse1: '5 rue Françoise-Giroud\nCS 16326\n44263 Nantes', + codePostal: '44263', + commune: 'Nantes', + cedex: 'Cedex', + regionId: '52' + }, + 'min-dajb-01': { + id: 'min-dajb-01', + typeId: 'min', + nom: "Ministère de l'Economie, des Finances et de la Relance", + abreviation: + "DAJ - Ministère de l'Economie, des Finances et de la Relance", + service: + "Bureau 4C. Droit de l'industrie, de l'énergie et des réseaux de communication", + url: 'http://www.economie.gouv.fr', + telephone: '01 44 97 03 32', + adresse1: '6 rue Louise-Weiss', + adresse2: 'Télédoc 342', + codePostal: '75703', + commune: 'Paris', + cedex: 'Cedex 13' + }, + 'min-mctrct-dgcl-01': { + id: 'min-mctrct-dgcl-01', + typeId: 'min', + nom: 'Ministère de la Cohésion des Territoires et des Relations avec les Collectivités Territoriales', + abreviation: 'DGCL/SDFLAE/FL1', + service: 'Bureau de la fiscalité locale', + url: 'https://www.cohesion-territoires.gouv.fr/direction-generale-des-collectivites-locales', + telephone: '01 49 27 31 59', + adresse1: '2 place des Saussaies', + codePostal: '75800', + commune: 'Paris' + }, + 'min-mtes-dgaln-01': { + id: 'min-mtes-dgaln-01', + typeId: 'min', + nom: "Ministère de l'Economie, des Finances et de la Relance & Ministère de la Transition écologique", + abreviation: 'DGALN/DEB/EARM2', + service: + "Bureau de la politique des ressources minérales non énergétiques - Direction générale de l'aménagement, du logement et de la nature (DGALN)", + url: 'http://www.mineralinfo.fr', + email: 'earm2.deb.dgaln@developpement-durable.gouv.fr', + telephone: '+33 (0)1 40 81 21 22', + adresse1: 'Tour Séquoia', + adresse2: '1 place Carpeaux', + codePostal: '92055', + commune: 'Paris-La-Défense', + cedex: 'Cedex' + }, + 'min-mtes-dgec-01': { + id: 'min-mtes-dgec-01', + typeId: 'min', + nom: "Ministère de l'Economie, des Finances et de la Relance & Ministère de la Transition écologique", + abreviation: 'DGEC/DE/SD2/2A', + service: + "Bureau Ressources énergétiques du sous-sol (2A) - Direction générale de l'énergie et du climat (DGEC)", + url: 'http://www.minergies.fr', + email: '2a.sd2.de.dgec@developpement-durable.gouv.fr', + telephone: '+33 (0)1 40 81 95 63', + adresse1: 'Tour Séquoia\n1 place Carpeaux\n92800 Puteaux', + adresse2: 'Adresse postale\r\n92055 Paris-La-Défense Cedex', + codePostal: '92800', + commune: 'Puteaux', + cedex: 'Cedex' + }, + 'min-mtes-dgpr-01': { + id: 'min-mtes-dgpr-01', + typeId: 'min', + nom: "Ministère de l'Economie, des Finances et de la Relance & Ministère de la Transition écologique", + abreviation: 'DGPR/SRT/SDRCP/BSSS', + service: + 'Bureau du sol et du sous-sol - Direction générale de la prévention des risques (DGPR)', + email: 'bsss.sdrcp.srt.dgpr@developpement-durable.gouv.fr', + telephone: '+33 (0)1 40 81 21 22', + adresse1: 'Tour Séquoia\n1 place Carpeaux\n92800 Puteaux', + adresse2: 'Adresse postale\n92055 Paris-La-Défense Cedex', + codePostal: '92800', + commune: 'Puteaux', + cedex: 'Cedex' + }, + 'ope-brgm-01': { + id: 'ope-brgm-01', + typeId: 'ope', + nom: 'Bureau de recherches géologiques et minières', + abreviation: 'BRGM', + url: 'https://www.brgm.fr/', + telephone: '02 38 64 34 34', + adresse1: '3 avenue Claude-Guillemin', + adresse2: 'BP 36009', + codePostal: '45060', + commune: 'Orléans', + cedex: 'Cedex 2' + }, + 'ope-brgm-02': { + id: 'ope-brgm-02', + typeId: 'ope', + nom: 'BRGM - Projet Zercoa', + abreviation: 'BRGM - Projet Zercoa', + service: + 'BRGM - Equipe projet "zones favorables à une exploitation et à un réaménagement coordonné de l\'or alluvionnaire"', + url: 'https://www.brgm.fr//', + telephone: '02 38 64 34 34', + adresse1: '3 avenue Claude-Guillemin', + adresse2: 'BP 36009', + codePostal: '45060', + commune: 'Orléans', + cedex: 'Cedex 2' + }, + 'ope-cacem-01': { + id: 'ope-cacem-01', + typeId: 'ope', + nom: "Centre d'appui au contrôle de l'environnement marin", + abreviation: 'Cacem', + service: 'DIRM NAMO/DOSM/CROSS Etel/CACEM', + url: 'http://extranet.legicem.metier.developpement-durable.gouv.fr', + email: 'cacem@developpement-durable.gouv.fr', + adresse1: + 'Centre régional opérationnel de surveillance et de sauvetage Atlantique', + adresse2: '40 avenue L. Bougo', + codePostal: '56410', + commune: 'Etel' + }, + 'ope-onf-973-01': { + id: 'ope-onf-973-01', + typeId: 'ope', + nom: 'Office national des forêts', + abreviation: 'Office national des forêts', + service: 'Direction territoriale Guyane', + url: 'http://www1.onf.fr/guyane/@@index.html', + email: 'pole.minier@onf.fr', + telephone: '+594 (0)5 94 25 53 78', + adresse1: '541 route de Montabo', + adresse2: 'Adresse postale\r\n541 route de Montabo\nCS87002', + codePostal: '97300', + commune: 'Cayenne', + regionId: '03' + }, + 'ope-ptmg-973-01': { + id: 'ope-ptmg-973-01', + typeId: 'ope', + nom: 'Pôle Technique Minier de Guyane', + abreviation: 'Pôle Technique Minier de Guyane', + telephone: '+594 (0)5 94 30 06 00', + adresse1: + 'Hôtel de la Collectivité Territoriale de Guyane, Carrefour de Suzini', + adresse2: '4179 route de Montabo', + codePostal: '97307', + commune: 'Cayenne' + }, + 'pre-01053-01': { + id: 'pre-01053-01', + typeId: 'pre', + nom: 'Préfecture - Ain', + abreviation: 'Préfecture - Ain', + adresse1: "45, avenue d'Alsace-Lorraine, CS 80400, Quartier Bourg centre", + codePostal: '01012', + commune: 'Bourg-en-Bresse Cedex', + telephone: '04 74 32 30 00', + departementId: '01', + email: 'prefecture@ain.gouv.fr', + url: 'http://www.ain.gouv.fr' + }, + 'pre-02408-01': { + id: 'pre-02408-01', + typeId: 'pre', + nom: 'Préfecture - Aisne', + abreviation: 'Préfecture - Aisne', + adresse1: '2, rue Paul-Doumer', + codePostal: '02010', + commune: 'Laon Cedex', + telephone: '03 23 21 82 82', + departementId: '02', + email: 'prefecture@aisne.gouv.fr', + url: 'http://www.aisne.gouv.fr' + }, + 'pre-03190-01': { + id: 'pre-03190-01', + typeId: 'pre', + nom: 'Préfecture - Allier', + abreviation: 'Préfecture - Allier', + adresse1: "2, rue Michel-de-L'Hospital, CS 31649", + codePostal: '03016', + commune: 'Moulins Cedex', + telephone: '04 70 48 30 00', + departementId: '03', + email: 'prefecture@allier.gouv.fr', + url: 'http://www.allier.gouv.fr' + }, + 'pre-04070-01': { + id: 'pre-04070-01', + typeId: 'pre', + nom: 'Préfecture - Alpes-de-Haute-Provence', + abreviation: 'Préfecture - Alpes-de-Haute-Provence', + adresse1: '8, rue Docteur-Romieu', + codePostal: '04016', + commune: 'Digne-les-Bains Cedex', + telephone: '04 92 36 72 00', + departementId: '04', + url: 'http://www.alpes-de-haute-provence.gouv.fr' + }, + 'pre-05061-01': { + id: 'pre-05061-01', + typeId: 'pre', + nom: 'Préfecture - Hautes-Alpes', + abreviation: 'Préfecture - Hautes-Alpes', + adresse1: '28, rue Saint-Arey, CS 66002', + codePostal: '05011', + commune: 'Gap Cedex', + telephone: '04 92 40 48 00', + departementId: '05', + email: 'prefecture@hautes-alpes.gouv.fr', + url: 'http://www.hautes-alpes.gouv.fr' + }, + 'pre-06088-01': { + id: 'pre-06088-01', + typeId: 'pre', + nom: 'Préfecture - Alpes-Maritimes', + abreviation: 'Préfecture - Alpes-Maritimes', + adresse1: 'CADAM, 147, route de Grenoble', + codePostal: '06000', + commune: 'Nice', + telephone: '04 93 72 20 00', + departementId: '06', + adresse2: + "Services de l'État dans les Alpes-Maritimes, Préfecture, CADAM, 147, route de Grenoble", + url: 'http://www.alpes-maritimes.gouv.fr' + }, + 'pre-07186-01': { + id: 'pre-07186-01', + typeId: 'pre', + nom: 'Préfecture - Ardèche', + abreviation: 'Préfecture - Ardèche', + adresse1: '4, boulevard de Vernon', + codePostal: '07000', + commune: 'Privas', + telephone: '04 75 66 50 00', + departementId: '07', + email: 'pref-courrier@ardeche.gouv.fr', + url: 'http://www.ardeche.gouv.fr' + }, + 'pre-08105-01': { + id: 'pre-08105-01', + typeId: 'pre', + nom: 'Préfecture - Ardennes', + abreviation: 'Préfecture - Ardennes', + adresse1: '1, place de la Préfecture, BP 60002', + codePostal: '08005', + commune: 'Charleville-Mézières Cedex', + telephone: '03 24 59 66 00', + departementId: '08', + email: 'prefecture@ardennes.gouv.fr', + url: 'http://www.ardennes.gouv.fr' + }, + 'pre-09122-01': { + id: 'pre-09122-01', + typeId: 'pre', + nom: 'Préfecture - Ariège', + abreviation: 'Préfecture - Ariège', + adresse1: '2, rue de la Préfecture - Préfet Claude Erignac, BP 4087', + codePostal: '09007', + commune: 'Foix Cedex', + telephone: '05 61 02 10 00', + departementId: '09', + email: 'prefecture@ariege.gouv.fr', + url: 'http://www.ariege.gouv.fr' + }, + 'pre-10387-01': { + id: 'pre-10387-01', + typeId: 'pre', + nom: 'Préfecture - Aube', + abreviation: 'Préfecture - Aube', + adresse1: 'CS 20372, 2, rue Pierre-Labonde', + codePostal: '10025', + commune: 'Troyes Cedex', + telephone: '03 25 42 35 00', + departementId: '10', + email: 'prefecture@aube.gouv.fr', + url: 'http://www.aube.gouv.fr' + }, + 'pre-11069-01': { + id: 'pre-11069-01', + typeId: 'pre', + nom: 'Préfecture - Aude', + abreviation: 'Préfecture - Aude', + adresse1: 'CS 20001, 52, rue Jean-Bringer', + codePostal: '11836', + commune: 'Carcassonne Cedex 9', + telephone: '04 68 10 27 00', + departementId: '11', + email: 'prefecture@aude.gouv.fr', + url: 'http://www.aude.gouv.fr' + }, + 'pre-12202-01': { + id: 'pre-12202-01', + typeId: 'pre', + nom: 'Préfecture - Aveyron', + abreviation: 'Préfecture - Aveyron', + adresse1: 'Centre administratif Foch, Place Foch', + codePostal: '12000', + commune: 'Rodez', + telephone: '05 65 75 71 71', + departementId: '12', + email: 'prefecture@aveyron.fr', + url: 'http://www.aveyron.gouv.fr' + }, + 'pre-13203-01': { + id: 'pre-13203-01', + typeId: 'pre', + nom: 'Préfecture - Bouches-du-Rhône', + abreviation: 'Préfecture - Bouches-du-Rhône', + adresse1: 'Boulevard Paul-Peytral', + codePostal: '13282', + commune: 'Marseille Cedex 20', + telephone: '04 84 35 40 00', + departementId: '13', + email: 'contact@bouches-du-rhone.pref.gouv.fr', + url: 'http://www.bouches-du-rhone.gouv.fr' + }, + 'pre-14118-01': { + id: 'pre-14118-01', + typeId: 'pre', + nom: 'Préfecture - Calvados', + abreviation: 'Préfecture - Calvados', + adresse1: 'Rue Daniel-Huet', + codePostal: '14038', + commune: 'Caen Cedex 9', + telephone: '02 31 30 64 00', + departementId: '14', + email: 'prefecture@calvados.gouv.fr', + url: 'http://www.calvados.gouv.fr' + }, + 'pre-15014-01': { + id: 'pre-15014-01', + typeId: 'pre', + nom: 'Préfecture - Cantal', + abreviation: 'Préfecture - Cantal', + adresse1: 'Cours Monthyon, BP 529', + codePostal: '15005', + commune: 'Aurillac Cedex', + telephone: '04 71 46 23 00', + departementId: '15', + email: 'courrier@cantal.pref.gouv.fr', + url: 'http://www.cantal.gouv.fr' + }, + 'pre-16015-01': { + id: 'pre-16015-01', + typeId: 'pre', + nom: 'Préfecture - Charente', + abreviation: 'Préfecture - Charente', + adresse1: '7-9, rue de la Préfecture, CS 92301', + codePostal: '16023', + commune: 'Angoulême Cedex', + telephone: '05 45 97 61 00', + departementId: '16', + email: 'communication@charente.gouv.fr', + url: 'http://www.charente.gouv.fr' + }, + 'pre-17300-01': { + id: 'pre-17300-01', + typeId: 'pre', + nom: 'Préfecture - Charente-Maritime', + abreviation: 'Préfecture - Charente-Maritime', + adresse1: 'CS 70000, 38, rue Réaumur', + codePostal: '17017', + commune: 'La Rochelle Cedex 1', + telephone: '05 46 27 43 00', + departementId: '17', + email: 'prefecture@charente-maritime.gouv.fr', + url: 'http://www.charente-maritime.gouv.fr' + }, + 'pre-18033-01': { + id: 'pre-18033-01', + typeId: 'pre', + nom: 'Préfecture - Cher', + abreviation: 'Préfecture - Cher', + adresse1: 'Place Marcel-Plaisant, CS 60022', + codePostal: '18020', + commune: 'Bourges Cedex', + telephone: '02 48 67 18 18', + departementId: '18', + email: 'prefecture@cher.gouv.fr', + url: 'http://www.cher.gouv.fr' + }, + 'pre-19272-01': { + id: 'pre-19272-01', + typeId: 'pre', + nom: 'Préfecture - Corrèze', + abreviation: 'Préfecture - Corrèze', + adresse1: '1, rue Souham, BP 250', + codePostal: '19012', + commune: 'Tulle Cedex', + telephone: '05 55 20 55 20', + departementId: '19', + email: 'prefecture@correze.gouv.fr', + url: 'http://www.correze.gouv.fr' + }, + 'pre-21231-01': { + id: 'pre-21231-01', + typeId: 'pre', + nom: "Préfecture - Côte-d'Or", + abreviation: "Préfecture - Côte-d'Or", + adresse1: '53, rue de la Préfecture', + codePostal: '21041', + commune: 'Dijon Cedex', + telephone: '03 80 44 64 00', + departementId: '21', + url: 'http://www.cote-dor.gouv.fr' + }, + 'pre-22278-01': { + id: 'pre-22278-01', + typeId: 'pre', + nom: "Préfecture - Côtes-d'Armor", + abreviation: "Préfecture - Côtes-d'Armor", + adresse1: '1, place du Général-de-Gaulle, BP 2370', + codePostal: '22023', + commune: 'Saint-Brieuc Cedex 1', + telephone: '02 96 62 44 22', + departementId: '22', + email: 'prefecture@cotes-darmor.gouv.fr', + url: 'http://www.cotes-darmor.gouv.fr' + }, + 'pre-23096-01': { + id: 'pre-23096-01', + typeId: 'pre', + nom: 'Préfecture - Creuse', + abreviation: 'Préfecture - Creuse', + adresse1: 'BP 79, Place Louis-Lacrocq', + codePostal: '23011', + commune: 'Guéret Cedex', + telephone: '05 55 51 59 00', + departementId: '23', + url: 'http://www.creuse.gouv.fr' + }, + 'pre-24322-01': { + id: 'pre-24322-01', + typeId: 'pre', + nom: 'Préfecture - Dordogne', + abreviation: 'Préfecture - Dordogne', + adresse1: '2, rue Paul-Louis-Courier', + codePostal: '24000', + commune: 'Périgueux', + telephone: '05 53 02 24 24', + departementId: '24', + adresse2: + "Services de l'État - Préfecture de la Dordogne, Cité adminsitrative", + email: 'prefecture@dordogne.gouv.fr', + url: 'http://www.dordogne.gouv.fr' + }, + 'pre-25056-01': { + id: 'pre-25056-01', + typeId: 'pre', + nom: 'Préfecture - Doubs', + abreviation: 'Préfecture - Doubs', + adresse1: '8 bis, rue Charles-Nodier', + codePostal: '25035', + commune: 'Besançon Cedex', + telephone: '03 81 25 10 00', + departementId: '25', + email: 'pref-courrier@doubs.gouv.fr', + url: 'http://www.doubs.gouv.fr' + }, + 'pre-26362-01': { + id: 'pre-26362-01', + typeId: 'pre', + nom: 'Préfecture - Drôme', + abreviation: 'Préfecture - Drôme', + adresse1: '3, boulevard Vauban', + codePostal: '26030', + commune: 'Valence Cedex 9', + telephone: '04 75 79 28 00', + departementId: '26', + email: 'prefecture@drome.gouv.fr', + url: 'http://www.drome.gouv.fr' + }, + 'pre-27229-01': { + id: 'pre-27229-01', + typeId: 'pre', + nom: 'Préfecture - Eure', + abreviation: 'Préfecture - Eure', + adresse1: 'Boulevard Georges-Chauvin', + codePostal: '27022', + commune: 'Evreux Cedex', + telephone: '02 32 78 27 27', + departementId: '27', + email: 'courrier-web@eure.gouv.fr', + url: 'http://www.seine-maritime.gouv.fr/Outils/Horaires-et-coordonnees/Prefecture-de-l-Eure' + }, + 'pre-28085-01': { + id: 'pre-28085-01', + typeId: 'pre', + nom: 'Préfecture - Eure-et-Loir', + abreviation: 'Préfecture - Eure-et-Loir', + adresse1: 'Place de la République, CS 80537', + codePostal: '28019', + commune: 'Chartres Cedex', + telephone: '02 37 27 72 00', + departementId: '28', + url: 'http://www.eure-et-loir.gouv.fr' + }, + 'pre-29232-01': { + id: 'pre-29232-01', + typeId: 'pre', + nom: 'Préfecture - Finistère', + abreviation: 'Préfecture - Finistère', + adresse1: '42, boulevard Dupleix', + codePostal: '29320', + commune: 'Quimper Cedex', + telephone: '02 98 76 29 29', + departementId: '29', + email: 'prefecture@finistere.gouv.fr', + url: 'http://www.finistere.gouv.fr' + }, + 'pre-2A004-01': { + id: 'pre-2A004-01', + typeId: 'pre', + nom: 'Préfecture - Corse-du-Sud', + abreviation: 'Préfecture - Corse-du-Sud', + adresse1: 'Palais Lantivy, Cours Napoléon', + codePostal: '20188', + commune: 'Ajaccio Cedex 9', + telephone: '04 95 11 12 13', + departementId: '2A', + email: 'prefecture@corse-du-sud.gouv.fr', + url: 'http://www.corse-du-sud.gouv.fr' + }, + 'pre-2B033-01': { + id: 'pre-2B033-01', + typeId: 'pre', + nom: 'Préfecture - Haute-Corse', + abreviation: 'Préfecture - Haute-Corse', + adresse1: 'CS 60007, Rond-Point du Maréchal-Leclerc-de-Hautecloque', + codePostal: '20401', + commune: 'Bastia Cedex 09', + telephone: '04 95 34 50 00', + departementId: '2B', + email: 'prefecture.haute-corse@haute-corse.pref.gouv.fr', + url: 'http://www.haute-corse.gouv.fr' + }, + 'pre-30189-01': { + id: 'pre-30189-01', + typeId: 'pre', + nom: 'Préfecture - Gard', + abreviation: 'Préfecture - Gard', + adresse1: '2, rue Guillemette, 19, avenue Feuchères (étrangers)', + codePostal: '30000', + commune: 'Nîmes', + telephone: '0820 09 11 72', + departementId: '30', + adresse2: '10, avenue Feuchères', + email: 'prefecture@gard.gouv.fr', + url: 'http://www.gard.gouv.fr' + }, + 'pre-31555-01': { + id: 'pre-31555-01', + typeId: 'pre', + nom: 'Préfecture - Haute-Garonne', + abreviation: 'Préfecture - Haute-Garonne', + adresse1: '1 place Saint-Étienne', + codePostal: '31000', + commune: 'Toulouse', + telephone: '05 34 45 34 45', + departementId: '31', + adresse2: 'Place Saint-Étienne', + url: 'http://www.haute-garonne.gouv.fr' + }, + 'pre-32013-01': { + id: 'pre-32013-01', + typeId: 'pre', + nom: 'Préfecture - Gers', + abreviation: 'Préfecture - Gers', + adresse1: '3, place du Préfet Claude-Erignac', + codePostal: '32007', + commune: 'Auch Cedex', + telephone: '05 62 61 44 00', + departementId: '32', + email: 'prefecture@gers.gouv.fr', + url: 'http://www.gers.gouv.fr' + }, + 'pre-33063-01': { + id: 'pre-33063-01', + typeId: 'pre', + nom: 'Préfecture - Gironde', + abreviation: 'Préfecture - Gironde', + adresse1: 'Rue Claude-Bonnier', + codePostal: '33000', + commune: 'Bordeaux', + telephone: '05 56 90 60 60', + departementId: '33', + adresse2: '2, esplanade Charles-de-Gaulle, CS 41397', + url: 'http://www.gironde.gouv.fr' + }, + 'pre-34172-01': { + id: 'pre-34172-01', + typeId: 'pre', + nom: 'Préfecture - Hérault', + abreviation: 'Préfecture - Hérault', + adresse1: '34, place des Martyrs-de-la-Résistance', + codePostal: '34062', + commune: 'Montpellier Cedex 2', + telephone: '04 67 61 61 61', + departementId: '34', + url: 'http://www.herault.gouv.fr' + }, + 'pre-35238-01': { + id: 'pre-35238-01', + typeId: 'pre', + nom: 'Préfecture - Ille-et-Vilaine', + abreviation: 'Préfecture - Ille-et-Vilaine', + adresse1: '3, avenue de la Préfecture', + codePostal: '35026', + commune: 'Rennes Cedex 9', + telephone: '02 99 02 10 35', + departementId: '35', + email: 'prefecture@ille-et-vilaine.gouv.fr', + url: 'https://www.ille-et-vilaine.gouv.fr' + }, + 'pre-36044-01': { + id: 'pre-36044-01', + typeId: 'pre', + nom: 'Préfecture - Indre', + abreviation: 'Préfecture - Indre', + adresse1: 'Rue des Jeux marins', + codePostal: '36000', + commune: 'Châteauroux', + telephone: '02 54 29 50 00', + departementId: '36', + adresse2: 'Place de la Victoire et des Alliés, CS 80583', + url: 'http://www.indre.gouv.fr' + }, + 'pre-37261-01': { + id: 'pre-37261-01', + typeId: 'pre', + nom: 'Préfecture - Indre-et-Loire', + abreviation: 'Préfecture - Indre-et-Loire', + adresse1: '15, rue Bernard-Palissy', + codePostal: '37925', + commune: 'Tours Cedex 9', + telephone: '+ 33 2 47 64 37 37', + departementId: '37', + email: 'prefecture@indre-et-loire.gouv.fr', + url: 'http://www.indre-et-loire.gouv.fr' + }, + 'pre-38185-01': { + id: 'pre-38185-01', + typeId: 'pre', + nom: 'Préfecture - Isère', + abreviation: 'Préfecture - Isère', + adresse1: 'CS 71046, Place de Verdun', + codePostal: '38021', + commune: 'Grenoble Cedex 1', + telephone: '04 76 60 34 00', + departementId: '38', + url: 'http://www.isere.gouv.fr' + }, + 'pre-39300-01': { + id: 'pre-39300-01', + typeId: 'pre', + nom: 'Préfecture - Jura', + abreviation: 'Préfecture - Jura', + adresse1: '8, rue de la Préfecture', + codePostal: '39030', + commune: 'Lons-le-Saunier Cedex', + telephone: '03 84 86 84 00', + departementId: '39', + email: 'prefecture@jura.gouv.fr', + url: 'http://www.jura.gouv.fr' + }, + 'pre-40192-01': { + id: 'pre-40192-01', + typeId: 'pre', + nom: 'Préfecture - Landes', + abreviation: 'Préfecture - Landes', + adresse1: '24-26, rue Victor-Hugo', + codePostal: '40021', + commune: 'Mont-de-Marsan Cedex', + telephone: '05 58 06 58 06', + departementId: '40', + email: 'prefecture@landes.gouv.fr', + url: 'http://www.landes.gouv.fr' + }, + 'pre-41018-01': { + id: 'pre-41018-01', + typeId: 'pre', + nom: 'Préfecture - Loir-et-Cher', + abreviation: 'Préfecture - Loir-et-Cher', + adresse1: 'BP 40299, 1, place de la République', + codePostal: '41006', + commune: 'Blois Cedex', + telephone: '0810 02 41 41', + departementId: '41', + url: 'http://www.loir-et-cher.gouv.fr' + }, + 'pre-42218-01': { + id: 'pre-42218-01', + typeId: 'pre', + nom: 'Préfecture - Loire', + abreviation: 'Préfecture - Loire', + adresse1: '2, rue Charles-de-Gaulle', + codePostal: '42022', + commune: 'Saint-Etienne Cedex 1', + telephone: '04 77 48 48 48', + departementId: '42', + email: 'pref-loire@loire.pref.gouv.fr', + url: 'http://www.loire.gouv.fr' + }, + 'pre-43157-01': { + id: 'pre-43157-01', + typeId: 'pre', + nom: 'Préfecture - Haute-Loire', + abreviation: 'Préfecture - Haute-Loire', + adresse1: '6, avenue du Général-de-Gaulle, CS 40321', + codePostal: '43009', + commune: 'Le Puy-en-Velay Cedex', + telephone: '04 71 09 43 43', + departementId: '43', + email: 'prefecture@haute-loire.gouv.fr', + url: 'http://www.haute-loire.gouv.fr' + }, + 'pre-44109-01': { + id: 'pre-44109-01', + typeId: 'pre', + nom: 'Préfecture - Loire-Atlantique', + abreviation: 'Préfecture - Loire-Atlantique', + adresse1: '6, quai Ceineray, BP 33515', + codePostal: '44035', + commune: 'Nantes Cedex 1', + telephone: '02 40 41 20 20', + departementId: '44', + url: 'http://www.loire-atlantique.gouv.fr' + }, + 'pre-45234-01': { + id: 'pre-45234-01', + typeId: 'pre', + nom: 'Préfecture - Loiret', + abreviation: 'Préfecture - Loiret', + adresse1: '181, rue de Bourgogne', + codePostal: '45042', + commune: 'Orléans Cedex 1', + telephone: '0821 80 30 45', + departementId: '45', + url: 'http://www.loiret.gouv.fr' + }, + 'pre-46042-01': { + id: 'pre-46042-01', + typeId: 'pre', + nom: 'Préfecture - Lot', + abreviation: 'Préfecture - Lot', + adresse1: 'Cité Bessières', + codePostal: '46009', + commune: 'Cahors Cedex 9', + telephone: '05 65 23 10 00', + departementId: '46', + email: 'prefecture@lot.gouv.fr', + url: 'http://www.lot.gouv.fr' + }, + 'pre-47001-01': { + id: 'pre-47001-01', + typeId: 'pre', + nom: 'Préfecture - Lot-et-Garonne', + abreviation: 'Préfecture - Lot-et-Garonne', + adresse1: 'Place de Verdun', + codePostal: '47920', + commune: 'Agen Cedex 9', + telephone: '05 53 77 60 47', + departementId: '47', + url: 'http://www.lot-et-garonne.gouv.fr' + }, + 'pre-48095-01': { + id: 'pre-48095-01', + typeId: 'pre', + nom: 'Préfecture - Lozère', + abreviation: 'Préfecture - Lozère', + adresse1: 'Rue du Faubourg-Montbel', + codePostal: '48000', + commune: 'Mende', + telephone: '04 66 49 60 00', + departementId: '48', + adresse2: 'BP 130', + email: 'prefecture@lozere.gouv.fr', + url: 'http://www.lozere.gouv.fr' + }, + 'pre-49007-01': { + id: 'pre-49007-01', + typeId: 'pre', + nom: 'Préfecture - Maine-et-Loire', + abreviation: 'Préfecture - Maine-et-Loire', + adresse1: 'Place Michel-Debré', + codePostal: '49934', + commune: 'Angers Cedex 9', + telephone: '02 41 81 81 81', + departementId: '49', + email: 'modernisation@maine-et-loire.pref.gouv.fr', + url: 'http://www.maine-et-loire.gouv.fr' + }, + 'pre-50502-01': { + id: 'pre-50502-01', + typeId: 'pre', + nom: 'Préfecture - Manche', + abreviation: 'Préfecture - Manche', + adresse1: 'Place de la Préfecture, BP 70522', + codePostal: '50002', + commune: 'Saint-Lô Cedex', + telephone: '02 33 75 49 50', + departementId: '50', + email: 'prefecture@manche.gouv.fr', + url: 'http://www.manche.gouv.fr' + }, + 'pre-51108-01': { + id: 'pre-51108-01', + typeId: 'pre', + nom: 'Préfecture - Marne', + abreviation: 'Préfecture - Marne', + adresse1: '38, rue Carnot', + codePostal: '51036', + commune: 'Châlons-en-Champagne Cedex', + telephone: '03 26 26 10 10', + departementId: '51', + email: 'contact@marne.gouv.fr', + url: 'http://www.marne.gouv.fr' + }, + 'pre-52121-01': { + id: 'pre-52121-01', + typeId: 'pre', + nom: 'Préfecture - Haute-Marne', + abreviation: 'Préfecture - Haute-Marne', + adresse1: '89, rue de la Victoire-de-la-Marne', + codePostal: '52011', + commune: 'Chaumont Cedex', + telephone: '03 25 30 52 52', + departementId: '52', + email: 'prefecture@haute-marne.gouv.fr', + url: 'http://www.haute-marne.gouv.fr' + }, + 'pre-53130-01': { + id: 'pre-53130-01', + typeId: 'pre', + nom: 'Préfecture - Mayenne', + abreviation: 'Préfecture - Mayenne', + adresse1: '46, rue Mazagran, CS 91507', + codePostal: '53015', + commune: 'Laval Cedex', + telephone: '02 43 01 50 00', + departementId: '53', + email: 'pref-communication@mayenne.gouv.fr', + url: 'http://www.mayenne.gouv.fr' + }, + 'pre-54395-01': { + id: 'pre-54395-01', + typeId: 'pre', + nom: 'Préfecture - Meurthe-et-Moselle', + abreviation: 'Préfecture - Meurthe-et-Moselle', + adresse1: '6, rue Sainte-Catherine', + codePostal: '54000', + commune: 'Nancy', + telephone: '03 83 34 26 26', + departementId: '54', + adresse2: 'CS 60031, 1, rue du Préfet-Claude-Érignac', + email: 'pref-informations@meurthe-et-moselle.gouv.fr', + url: 'http://www.meurthe-et-moselle.gouv.fr' + }, + 'pre-55029-01': { + id: 'pre-55029-01', + typeId: 'pre', + nom: 'Préfecture - Meuse', + abreviation: 'Préfecture - Meuse', + adresse1: '40, rue du Bourg, CS 30512', + codePostal: '55012', + commune: 'Bar-le-Duc Cedex', + telephone: '03 29 77 55 55', + departementId: '55', + url: 'http://www.meuse.gouv.fr' + }, + 'pre-56260-01': { + id: 'pre-56260-01', + typeId: 'pre', + nom: 'Préfecture - Morbihan', + abreviation: 'Préfecture - Morbihan', + adresse1: '24, place de la République', + codePostal: '56000', + commune: 'Vannes', + telephone: '02 97 54 84 00', + departementId: '56', + adresse2: 'Préfecture du Morbihan, BP 501', + url: 'http://www.morbihan.gouv.fr' + }, + 'pre-57463-01': { + id: 'pre-57463-01', + typeId: 'pre', + nom: 'Préfecture - Moselle', + abreviation: 'Préfecture - Moselle', + adresse1: '9, place de la Préfecture, BP 71014', + codePostal: '57034', + commune: 'Metz Cedex 01', + telephone: '03 87 34 87 34', + departementId: '57' + }, + 'pre-58194-01': { + id: 'pre-58194-01', + typeId: 'pre', + nom: 'Préfecture - Nièvre', + abreviation: 'Préfecture - Nièvre', + adresse1: '40, rue de la Préfecture', + codePostal: '58026', + commune: 'Nevers Cedex', + telephone: '03 86 60 70 80', + departementId: '58', + email: 'courrier@nievre.pref.gouv.fr', + url: 'http://www.nievre.gouv.fr' + }, + 'pre-59350-01': { + id: 'pre-59350-01', + typeId: 'pre', + nom: 'Préfecture - Nord', + abreviation: 'Préfecture - Nord', + adresse1: 'CS 20003, 12, rue Jean-Sans-Peur', + codePostal: '59039', + commune: 'Lille Cedex', + telephone: '03 20 30 59 59', + departementId: '59', + url: 'http://www.nord.gouv.fr' + }, + 'pre-60057-01': { + id: 'pre-60057-01', + typeId: 'pre', + nom: 'Préfecture - Oise', + abreviation: 'Préfecture - Oise', + adresse1: '1, place de la Préfecture', + codePostal: '60022', + commune: 'Beauvais Cedex', + telephone: '03 44 06 12 60', + departementId: '60', + url: 'http://www.oise.gouv.fr' + }, + 'pre-61001-01': { + id: 'pre-61001-01', + typeId: 'pre', + nom: 'Préfecture - Orne', + abreviation: 'Préfecture - Orne', + adresse1: 'BP 529, 39, rue Saint-Blaise', + codePostal: '61018', + commune: 'Alençon Cedex', + telephone: '02 33 80 61 61', + departementId: '61', + email: 'pref-communication@orne.gouv.fr', + url: 'http://www.orne.gouv.fr' + }, + 'pre-62041-01': { + id: 'pre-62041-01', + typeId: 'pre', + nom: 'Préfecture - Pas-de-Calais', + abreviation: 'Préfecture - Pas-de-Calais', + adresse1: 'Rue Ferdinand-Buisson', + codePostal: '62020', + commune: 'Arras Cedex 9', + telephone: '03 21 21 20 00', + departementId: '62', + url: 'http://www.pas-de-calais.gouv.fr' + }, + 'pre-63113-01': { + id: 'pre-63113-01', + typeId: 'pre', + nom: 'Préfecture - Puy-de-Dôme', + abreviation: 'Préfecture - Puy-de-Dôme', + adresse1: "1, rue d'Assas", + codePostal: '63033', + commune: 'Clermont-Ferrand Cedex 1', + telephone: '04 73 98 63 63', + departementId: '63', + url: 'http://www.puy-de-dome.gouv.fr' + }, + 'pre-64445-01': { + id: 'pre-64445-01', + typeId: 'pre', + nom: 'Préfecture - Pyrénées-Atlantiques', + abreviation: 'Préfecture - Pyrénées-Atlantiques', + adresse1: '2, rue du Maréchal-Joffre', + codePostal: '64021', + commune: 'Pau Cedex', + telephone: '05 59 98 24 24', + departementId: '64', + email: 'prefecture@pyrenees-atlantiques.gouv.fr', + url: 'http://www.pyrenees-atlantiques.gouv.fr' + }, + 'pre-65440-01': { + id: 'pre-65440-01', + typeId: 'pre', + nom: 'Préfecture - Hautes-Pyrénées', + abreviation: 'Préfecture - Hautes-Pyrénées', + adresse1: 'CS 61350, Place Charles-de-Gaulle', + codePostal: '65013', + commune: 'Tarbes Cedex 9', + telephone: '05 62 56 65 65', + departementId: '65', + email: 'prefecture@hautes-pyrenees.gouv.fr', + url: 'http://www.hautes-pyrenees.gouv.fr' + }, + 'pre-66136-01': { + id: 'pre-66136-01', + typeId: 'pre', + nom: 'Préfecture - Pyrénées-Orientales', + abreviation: 'Préfecture - Pyrénées-Orientales', + adresse1: '24, quai Sadi-Carnot, BP 951', + codePostal: '66951', + commune: 'Perpignan Cedex', + telephone: '04 68 51 66 66', + departementId: '66', + url: 'http://www.pyrenees-orientales.gouv.fr' + }, + 'pre-67482-01': { + id: 'pre-67482-01', + typeId: 'pre', + nom: 'Préfecture - Bas-Rhin', + abreviation: 'Préfecture - Bas-Rhin', + adresse1: '5 place de la République, BP 1047', + codePostal: '67073', + commune: 'Strasbourg Cedex', + telephone: '03 88 21 67 68', + departementId: '67', + url: 'http://www.bas-rhin.gouv.fr' + }, + 'pre-68066-01': { + id: 'pre-68066-01', + typeId: 'pre', + nom: 'Préfecture - Haut-Rhin', + abreviation: 'Préfecture - Haut-Rhin', + adresse1: '11, avenue de la République', + codePostal: '68000', + commune: 'Colmar', + telephone: '03 89 29 20 00', + departementId: '68', + adresse2: '7, rue Bruat, BP 10489', + email: 'pref-courrier@haut-rhin.gouv.fr', + url: 'http://www.haut-rhin.gouv.fr' + }, + 'pre-69383-01': { + id: 'pre-69383-01', + typeId: 'pre', + nom: 'Préfecture - Rhône', + abreviation: 'Préfecture - Rhône', + adresse1: '97, rue Molière', + codePostal: '69003', + commune: 'Lyon', + telephone: '0821 80 30 69', + departementId: '69', + adresse2: '106, rue Pierre-Corneille', + url: 'http://www.rhone.gouv.fr' + }, + 'pre-70550-01': { + id: 'pre-70550-01', + typeId: 'pre', + nom: 'Préfecture - Haute-Saône', + abreviation: 'Préfecture - Haute-Saône', + adresse1: '1, rue de la Préfecture, BP 429', + codePostal: '70013', + commune: 'Vesoul Cedex', + telephone: '03 84 77 70 00', + departementId: '70', + email: 'prefecture@haute-saone.pref.gouv.fr', + url: 'http://www.haute-saone.gouv.fr' + }, + 'pre-71270-01': { + id: 'pre-71270-01', + typeId: 'pre', + nom: 'Préfecture - Saône-et-Loire', + abreviation: 'Préfecture - Saône-et-Loire', + adresse1: '196, rue de Strasbourg', + codePostal: '71021', + commune: 'Mâcon Cedex 9', + telephone: '03 85 21 81 00', + departementId: '71', + url: 'http://www.saone-et-loire.gouv.fr/prefecture-et-sous-prefectures-r1071.html' + }, + 'pre-72181-01': { + id: 'pre-72181-01', + typeId: 'pre', + nom: 'Préfecture - Sarthe', + abreviation: 'Préfecture - Sarthe', + adresse1: 'Place Aristide-Briand', + codePostal: '72041', + commune: 'Le Mans Cedex 9', + telephone: '02 43 39 72 72', + departementId: '72', + email: 'pref-mail@sarthe.gouv.fr', + url: 'http://www.sarthe.gouv.fr' + }, + 'pre-73065-01': { + id: 'pre-73065-01', + typeId: 'pre', + nom: 'Préfecture - Savoie', + abreviation: 'Préfecture - Savoie', + adresse1: 'Château des Ducs de Savoie, BP 1801', + codePostal: '73018', + commune: 'Chambéry Cedex', + telephone: '04 79 75 50 50', + departementId: '73', + email: 'prefecture@savoie.gouv.fr', + url: 'http://www.savoie.gouv.fr' + }, + 'pre-74010-01': { + id: 'pre-74010-01', + typeId: 'pre', + nom: 'Préfecture - Haute-Savoie', + abreviation: 'Préfecture - Haute-Savoie', + adresse1: "30, rue du 30e-Régiment-d'Infanterie, BP 2332", + codePostal: '74034', + commune: 'Annecy Cedex', + telephone: '04 50 33 60 00', + departementId: '74', + email: 'prefecture@haute-savoie.gouv.fr', + url: 'http://www.haute-savoie.gouv.fr' + }, + 'pre-75104-01': { + id: 'pre-75104-01', + typeId: 'pre', + nom: 'Préfecture de police de Paris', + abreviation: 'Préfecture de police de Paris', + adresse1: '1 bis rue de Lutèce', + codePostal: '75004', + commune: 'Paris', + telephone: '3430', + departementId: '75', + url: 'http://www.prefecturedepolice.interieur.gouv.fr' + }, + 'pre-76540-01': { + id: 'pre-76540-01', + typeId: 'pre', + nom: 'Préfecture - Seine-Maritime', + abreviation: 'Préfecture - Seine-Maritime', + adresse1: '7, place de la Madeleine', + codePostal: '76036', + commune: 'Rouen Cedex', + telephone: '02 32 76 50 00', + departementId: '76', + url: 'http://www.seine-maritime.gouv.fr' + }, + 'pre-77288-01': { + id: 'pre-77288-01', + typeId: 'pre', + nom: 'Préfecture - Seine-et-Marne', + abreviation: 'Préfecture - Seine-et-Marne', + adresse1: '12 rue des Saints-Pères', + codePostal: '77010', + commune: 'Melun Cedex', + telephone: '01 64 71 76 77', + departementId: '77', + url: 'http://www.seine-et-marne.gouv.fr' + }, + 'pre-78646-01': { + id: 'pre-78646-01', + typeId: 'pre', + nom: 'Préfecture - Yvelines', + abreviation: 'Préfecture - Yvelines', + adresse1: '1, rue Jean-Houdon', + codePostal: '78000', + commune: 'Versailles', + telephone: '01 39 49 78 00', + departementId: '78', + email: 'pref-communication78@yvelines.gouv.fr', + url: 'http://www.yvelines.gouv.fr' + }, + 'pre-79191-01': { + id: 'pre-79191-01', + typeId: 'pre', + nom: 'Préfecture - Deux-Sèvres', + abreviation: 'Préfecture - Deux-Sèvres', + adresse1: '4, rue Duguesclin, BP 70000', + codePostal: '79099', + commune: 'Niort Cedex 9', + telephone: '05 49 08 68 68', + departementId: '79', + email: 'courrier@deux-sevres.pref.gouv.fr', + url: 'http://www.deux-sevres.gouv.fr' + }, + 'pre-80021-01': { + id: 'pre-80021-01', + typeId: 'pre', + nom: 'Préfecture - Somme', + abreviation: 'Préfecture - Somme', + adresse1: '51, rue de la République', + codePostal: '80020', + commune: 'Amiens Cedex 9', + telephone: '0821 80 30 80', + departementId: '80', + email: 'pref-courrier@somme.gouv.fr', + url: 'http://www.somme.gouv.fr' + }, + 'pre-81004-01': { + id: 'pre-81004-01', + typeId: 'pre', + nom: 'Préfecture - Tarn', + abreviation: 'Préfecture - Tarn', + adresse1: 'Place de la Préfecture', + codePostal: '81013', + commune: 'Albi Cedex 9', + telephone: '05 63 45 61 61', + departementId: '81', + email: 'courrier@tarn.pref.gouv.fr', + url: 'http://www.tarn.gouv.fr' + }, + 'pre-82121-01': { + id: 'pre-82121-01', + typeId: 'pre', + nom: 'Préfecture - Tarn-et-Garonne', + abreviation: 'Préfecture - Tarn-et-Garonne', + adresse1: "2, allée de l'Empereur, BP 779", + codePostal: '82013', + commune: 'Montauban Cedex', + telephone: '05 63 22 82 00', + departementId: '82', + url: 'http://www.tarn-et-garonne.gouv.fr' + }, + 'pre-83137-01': { + id: 'pre-83137-01', + typeId: 'pre', + nom: 'Préfecture - Var', + abreviation: 'Préfecture - Var', + adresse1: "CS 31209, Boulevard du 112e Régiment-d'Infanterie", + codePostal: '83070', + commune: 'Toulon Cedex', + telephone: '04 94 18 83 83', + departementId: '83', + url: 'http://www.var.gouv.fr' + }, + 'pre-84007-01': { + id: 'pre-84007-01', + typeId: 'pre', + nom: 'Préfecture - Vaucluse', + abreviation: 'Préfecture - Vaucluse', + adresse1: '2, avenue de la Folie', + codePostal: '84000', + commune: 'Avignon', + telephone: '04 88 17 84 84', + departementId: '84', + adresse2: "Services de l'Etat en Vaucluse Préfecture", + email: 'pref-contact@vaucluse.gouv.fr', + url: 'http://www.vaucluse.gouv.fr' + }, + 'pre-85191-01': { + id: 'pre-85191-01', + typeId: 'pre', + nom: 'Préfecture - Vendée', + abreviation: 'Préfecture - Vendée', + adresse1: '29, rue Delille', + codePostal: '85922', + commune: 'La Roche-sur-Yon Cedex 9', + telephone: '02 51 36 70 85', + departementId: '85', + email: 'prefecture@vendee.gouv.fr', + url: 'http://www.vendee.gouv.fr' + }, + 'pre-86194-01': { + id: 'pre-86194-01', + typeId: 'pre', + nom: 'Préfecture - Vienne', + abreviation: 'Préfecture - Vienne', + adresse1: 'BP 589, 7, place Aristide-Briand', + codePostal: '86021', + commune: 'Poitiers Cedex', + telephone: '05 49 55 70 00', + departementId: '86', + email: 'pref-courrier@vienne.gouv.fr', + url: 'http://www.vienne.gouv.fr' + }, + 'pre-87085-01': { + id: 'pre-87085-01', + typeId: 'pre', + nom: 'Préfecture - Haute-Vienne', + abreviation: 'Préfecture - Haute-Vienne', + adresse1: '12 rue des Combes', + codePostal: '87000', + commune: 'Limoges', + telephone: '05 55 44 18 00', + departementId: '87', + url: 'http://www.haute-vienne.gouv.fr' + }, + 'pre-88160-01': { + id: 'pre-88160-01', + typeId: 'pre', + nom: 'Préfecture - Vosges', + abreviation: 'Préfecture - Vosges', + adresse1: '1, place Foch', + codePostal: '88026', + commune: 'Epinal Cedex', + telephone: '03 29 69 88 88', + departementId: '88', + email: 'prefecture@vosges.gouv.fr', + url: 'http://www.vosges.gouv.fr' + }, + 'pre-89024-01': { + id: 'pre-89024-01', + typeId: 'pre', + nom: 'Préfecture - Yonne', + abreviation: 'Préfecture - Yonne', + adresse1: 'Place de la Préfecture', + codePostal: '89016', + commune: 'Auxerre Cedex', + telephone: '03 86 72 79 89', + departementId: '89', + email: 'prefecture@yonne.gouv.fr', + url: 'http://www.yonne.gouv.fr' + }, + 'pre-90010-01': { + id: 'pre-90010-01', + typeId: 'pre', + nom: 'Préfecture - Territoire de Belfort', + abreviation: 'Préfecture - Territoire de Belfort', + adresse1: 'Place de la République', + codePostal: '90020', + commune: 'Belfort Cedex', + telephone: '03 84 57 00 07', + departementId: '90', + email: 'courrier90@territoire-de-belfort.pref.gouv.fr', + url: 'http://www.territoire-belfort.gouv.fr' + }, + 'pre-91228-01': { + id: 'pre-91228-01', + typeId: 'pre', + nom: 'Préfecture - Essonne', + abreviation: 'Préfecture - Essonne', + adresse1: 'Boulevard de France', + codePostal: '91010', + commune: 'Évry Courcouronnes cedex', + telephone: '01 69 91 91 91', + departementId: '91', + email: 'prefecture@essonne.gouv.fr', + url: 'http://www.essonne.gouv.fr' + }, + 'pre-92050-01': { + id: 'pre-92050-01', + typeId: 'pre', + nom: 'Préfecture - Hauts-de-Seine', + abreviation: 'Préfecture - Hauts-de-Seine', + adresse1: '167-177, avenue Joliot-Curie', + codePostal: '92013', + commune: 'Nanterre Cedex', + telephone: '01 40 97 20 00', + departementId: '92', + email: 'prefecture@hauts-de-seine.gouv.fr', + url: 'http://www.hauts-de-seine.gouv.fr' + }, + 'pre-93008-01': { + id: 'pre-93008-01', + typeId: 'pre', + nom: 'Préfecture - Seine-Saint-Denis', + abreviation: 'Préfecture - Seine-Saint-Denis', + adresse1: '1, esplanade Jean-Moulin', + codePostal: '93007', + commune: 'Bobigny Cedex', + telephone: '01 41 60 60 60', + departementId: '93', + email: 'prefecture@seine-saint-denis.gouv.fr', + url: 'http://www.seine-saint-denis.gouv.fr' + }, + 'pre-94028-01': { + id: 'pre-94028-01', + typeId: 'pre', + nom: 'Préfecture - Val-de-Marne', + abreviation: 'Préfecture - Val-de-Marne', + adresse1: '21-29, avenue du Général-de-Gaulle', + codePostal: '94038', + commune: 'Créteil Cedex', + telephone: '01 49 56 60 00', + departementId: '94', + email: 'prefecture@val-de-marne.gouv.fr', + url: 'http://www.val-de-marne.gouv.fr' + }, + 'pre-95127-01': { + id: 'pre-95127-01', + typeId: 'pre', + nom: "Préfecture - Val-d'Oise", + abreviation: "Préfecture - Val-d'Oise", + adresse1: 'CS 20105, 5, avenue Bernard-Hirsch', + codePostal: '95010', + commune: 'Cergy-Pontoise Cedex', + telephone: '01 34 20 95 95', + departementId: '95', + email: 'prefecture@val-doise.gouv.fr', + url: 'http://www.val-doise.gouv.fr' + }, + 'pre-97105-01': { + id: 'pre-97105-01', + typeId: 'pre', + nom: 'Préfecture - Guadeloupe', + abreviation: 'Préfecture - Guadeloupe', + adresse1: 'Avenue Paul-Lacavé', + codePostal: '97109', + commune: 'Basse-Terre Cedex', + telephone: '+590 590 99 39 00', + departementId: '971', + url: 'http://www.guadeloupe.pref.gouv.fr' + }, + 'pre-97209-01': { + id: 'pre-97209-01', + typeId: 'pre', + nom: 'Préfecture - Martinique', + abreviation: 'Préfecture - Martinique', + adresse1: '82, rue Victor-Sévère', + codePostal: '97262', + commune: 'Fort-de-France Cedex', + telephone: '+596 596 39 36 00', + departementId: '972', + email: 'contact.prefecture@martinique.pref.gouv.fr', + url: 'http://www.martinique.pref.gouv.fr' + }, + 'pre-97302-01': { + id: 'pre-97302-01', + typeId: 'pre', + nom: 'Préfecture - Guyane', + abreviation: 'Préfecture - Guyane', + url: 'http://www.guyane.pref.gouv.fr', + email: 'courrier@guyane.pref.gouv.fr', + telephone: '+594 594 39 45 00', + adresse1: 'BP 7008, Rue Fiedmond', + codePostal: '97307', + commune: 'Cayenne Cedex', + departementId: '973' + }, + 'pre-97411-01': { + id: 'pre-97411-01', + typeId: 'pre', + nom: 'Préfecture - La Réunion', + abreviation: 'Préfecture - La Réunion', + adresse1: '1, rue de la Messagerie, CS 51079', + codePostal: '97404', + commune: 'Saint-Denis Cedex', + telephone: '+262 262 40 77 77', + departementId: '974', + url: 'http://www.reunion.gouv.fr' + }, + 'pre-97611-01': { + id: 'pre-97611-01', + typeId: 'pre', + nom: 'Préfecture - Mayotte', + abreviation: 'Préfecture - Mayotte', + adresse1: 'BP 676, Kawéni, Avenue de la Préfecture', + codePostal: '97600', + commune: 'Mamoudzou', + telephone: '+262 269 63 50 00', + departementId: '976', + url: 'http://www.mayotte.pref.gouv.fr/' + } + } // ----- ne pas supprimer cette ligne : fin + +export const sortedAdministrations = Object.values(Administrations).sort( + (a, b) => a.abreviation.localeCompare(b.abreviation) +) diff --git a/packages/common/src/departement.ts b/packages/common/src/departement.ts new file mode 100644 index 000000000..10ca6f025 --- /dev/null +++ b/packages/common/src/departement.ts @@ -0,0 +1,621 @@ +import { RegionId } from './region' + +export const DEPARTEMENT_IDS = { + Ain: '01', + Aisne: '02', + Allier: '03', + 'Alpes-de-Haute-Provence': '04', + 'Hautes-Alpes': '05', + 'Alpes-Maritimes': '06', + Ardèche: '07', + Ardennes: '08', + Ariège: '09', + Aube: '10', + Aude: '11', + Aveyron: '12', + 'Bouches-du-Rhône': '13', + Calvados: '14', + Cantal: '15', + Charente: '16', + 'Charente-Maritime': '17', + Cher: '18', + Corrèze: '19', + "Côte-d'Or": '21', + "Côtes-d'Armor": '22', + Creuse: '23', + Dordogne: '24', + Doubs: '25', + Drôme: '26', + Eure: '27', + 'Eure-et-Loir': '28', + Finistère: '29', + 'Corse-du-Sud': '2A', + 'Haute-Corse': '2B', + Gard: '30', + 'Haute-Garonne': '31', + Gers: '32', + Gironde: '33', + Hérault: '34', + 'Ille-et-Vilaine': '35', + Indre: '36', + 'Indre-et-Loire': '37', + Isère: '38', + Jura: '39', + Landes: '40', + 'Loir-et-Cher': '41', + Loire: '42', + 'Haute-Loire': '43', + 'Loire-Atlantique': '44', + Loiret: '45', + Lot: '46', + 'Lot-et-Garonne': '47', + Lozère: '48', + 'Maine-et-Loire': '49', + Manche: '50', + Marne: '51', + 'Haute-Marne': '52', + Mayenne: '53', + 'Meurthe-et-Moselle': '54', + Meuse: '55', + Morbihan: '56', + Moselle: '57', + Nièvre: '58', + Nord: '59', + Oise: '60', + Orne: '61', + 'Pas-de-Calais': '62', + 'Puy-de-Dôme': '63', + 'Pyrénées-Atlantiques': '64', + 'Hautes-Pyrénées': '65', + 'Pyrénées-Orientales': '66', + 'Bas-Rhin': '67', + 'Haut-Rhin': '68', + Rhône: '69', + 'Haute-Saône': '70', + 'Saône-et-Loire': '71', + Sarthe: '72', + Savoie: '73', + 'Haute-Savoie': '74', + Paris: '75', + 'Seine-Maritime': '76', + 'Seine-et-Marne': '77', + Yvelines: '78', + 'Deux-Sèvres': '79', + Somme: '80', + Tarn: '81', + 'Tarn-et-Garonne': '82', + Var: '83', + Vaucluse: '84', + Vendée: '85', + Vienne: '86', + 'Haute-Vienne': '87', + Vosges: '88', + Yonne: '89', + 'Territoire de Belfort': '90', + Essonne: '91', + 'Hauts-de-Seine': '92', + 'Seine-Saint-Denis': '93', + 'Val-de-Marne': '94', + "Val-d'Oise": '95', + Guadeloupe: '971', + Martinique: '972', + Guyane: '973', + 'La Réunion': '974', + Mayotte: '976' +} as const + +export interface Departement<T = DepartementId> { + id: T + nom: string + region_id: RegionId +} + +export type DepartementId = typeof DEPARTEMENT_IDS[keyof typeof DEPARTEMENT_IDS] + +export const Departements: { [key in DepartementId]: Departement<key> } = { + '01': { + id: '01', + nom: 'Ain', + region_id: '84' + }, + '02': { + id: '02', + nom: 'Aisne', + region_id: '32' + }, + '03': { + id: '03', + nom: 'Allier', + region_id: '84' + }, + '04': { + id: '04', + nom: 'Alpes-de-Haute-Provence', + region_id: '93' + }, + '05': { + id: '05', + nom: 'Hautes-Alpes', + region_id: '93' + }, + '06': { + id: '06', + nom: 'Alpes-Maritimes', + region_id: '93' + }, + '07': { + id: '07', + nom: 'Ardèche', + region_id: '84' + }, + '08': { + id: '08', + nom: 'Ardennes', + region_id: '44' + }, + '09': { + id: '09', + nom: 'Ariège', + region_id: '76' + }, + '10': { + id: '10', + nom: 'Aube', + region_id: '44' + }, + '11': { + id: '11', + nom: 'Aude', + region_id: '76' + }, + '12': { + id: '12', + nom: 'Aveyron', + region_id: '76' + }, + '13': { + id: '13', + nom: 'Bouches-du-Rhône', + region_id: '93' + }, + '14': { + id: '14', + nom: 'Calvados', + region_id: '28' + }, + '15': { + id: '15', + nom: 'Cantal', + region_id: '84' + }, + '16': { + id: '16', + nom: 'Charente', + region_id: '75' + }, + '17': { + id: '17', + nom: 'Charente-Maritime', + region_id: '75' + }, + '18': { + id: '18', + nom: 'Cher', + region_id: '24' + }, + '19': { + id: '19', + nom: 'Corrèze', + region_id: '75' + }, + '21': { + id: '21', + nom: "Côte-d'Or", + region_id: '27' + }, + '22': { + id: '22', + nom: "Côtes-d'Armor", + region_id: '53' + }, + '23': { + id: '23', + nom: 'Creuse', + region_id: '75' + }, + '24': { + id: '24', + nom: 'Dordogne', + region_id: '75' + }, + '25': { + id: '25', + nom: 'Doubs', + region_id: '27' + }, + '26': { + id: '26', + nom: 'Drôme', + region_id: '84' + }, + '27': { + id: '27', + nom: 'Eure', + region_id: '28' + }, + '28': { + id: '28', + nom: 'Eure-et-Loir', + region_id: '24' + }, + '29': { + id: '29', + nom: 'Finistère', + region_id: '53' + }, + '2A': { + id: '2A', + nom: 'Corse-du-Sud', + region_id: '94' + }, + '2B': { + id: '2B', + nom: 'Haute-Corse', + region_id: '94' + }, + '30': { + id: '30', + nom: 'Gard', + region_id: '76' + }, + '31': { + id: '31', + nom: 'Haute-Garonne', + region_id: '76' + }, + '32': { + id: '32', + nom: 'Gers', + region_id: '76' + }, + '33': { + id: '33', + nom: 'Gironde', + region_id: '75' + }, + '34': { + id: '34', + nom: 'Hérault', + region_id: '76' + }, + '35': { + id: '35', + nom: 'Ille-et-Vilaine', + region_id: '53' + }, + '36': { + id: '36', + nom: 'Indre', + region_id: '24' + }, + '37': { + id: '37', + nom: 'Indre-et-Loire', + region_id: '24' + }, + '38': { + id: '38', + nom: 'Isère', + region_id: '84' + }, + '39': { + id: '39', + nom: 'Jura', + region_id: '27' + }, + '40': { + id: '40', + nom: 'Landes', + region_id: '75' + }, + '41': { + id: '41', + nom: 'Loir-et-Cher', + region_id: '24' + }, + '42': { + id: '42', + nom: 'Loire', + region_id: '84' + }, + '43': { + id: '43', + nom: 'Haute-Loire', + region_id: '84' + }, + '44': { + id: '44', + nom: 'Loire-Atlantique', + region_id: '52' + }, + '45': { + id: '45', + nom: 'Loiret', + region_id: '24' + }, + '46': { + id: '46', + nom: 'Lot', + region_id: '76' + }, + '47': { + id: '47', + nom: 'Lot-et-Garonne', + region_id: '75' + }, + '48': { + id: '48', + nom: 'Lozère', + region_id: '76' + }, + '49': { + id: '49', + nom: 'Maine-et-Loire', + region_id: '52' + }, + '50': { + id: '50', + nom: 'Manche', + region_id: '28' + }, + '51': { + id: '51', + nom: 'Marne', + region_id: '44' + }, + '52': { + id: '52', + nom: 'Haute-Marne', + region_id: '44' + }, + '53': { + id: '53', + nom: 'Mayenne', + region_id: '52' + }, + '54': { + id: '54', + nom: 'Meurthe-et-Moselle', + region_id: '44' + }, + '55': { + id: '55', + nom: 'Meuse', + region_id: '44' + }, + '56': { + id: '56', + nom: 'Morbihan', + region_id: '53' + }, + '57': { + id: '57', + nom: 'Moselle', + region_id: '44' + }, + '58': { + id: '58', + nom: 'Nièvre', + region_id: '27' + }, + '59': { + id: '59', + nom: 'Nord', + region_id: '32' + }, + '60': { + id: '60', + nom: 'Oise', + region_id: '32' + }, + '61': { + id: '61', + nom: 'Orne', + region_id: '28' + }, + '62': { + id: '62', + nom: 'Pas-de-Calais', + region_id: '32' + }, + '63': { + id: '63', + nom: 'Puy-de-Dôme', + region_id: '84' + }, + '64': { + id: '64', + nom: 'Pyrénées-Atlantiques', + region_id: '75' + }, + '65': { + id: '65', + nom: 'Hautes-Pyrénées', + region_id: '76' + }, + '66': { + id: '66', + nom: 'Pyrénées-Orientales', + region_id: '76' + }, + '67': { + id: '67', + nom: 'Bas-Rhin', + region_id: '44' + }, + '68': { + id: '68', + nom: 'Haut-Rhin', + region_id: '44' + }, + '69': { + id: '69', + nom: 'Rhône', + region_id: '84' + }, + '70': { + id: '70', + nom: 'Haute-Saône', + region_id: '27' + }, + '71': { + id: '71', + nom: 'Saône-et-Loire', + region_id: '27' + }, + '72': { + id: '72', + nom: 'Sarthe', + region_id: '52' + }, + '73': { + id: '73', + nom: 'Savoie', + region_id: '84' + }, + '74': { + id: '74', + nom: 'Haute-Savoie', + region_id: '84' + }, + '75': { + id: '75', + nom: 'Paris', + region_id: '11' + }, + '76': { + id: '76', + nom: 'Seine-Maritime', + region_id: '28' + }, + '77': { + id: '77', + nom: 'Seine-et-Marne', + region_id: '11' + }, + '78': { + id: '78', + nom: 'Yvelines', + region_id: '11' + }, + '79': { + id: '79', + nom: 'Deux-Sèvres', + region_id: '75' + }, + '80': { + id: '80', + nom: 'Somme', + region_id: '32' + }, + '81': { + id: '81', + nom: 'Tarn', + region_id: '76' + }, + '82': { + id: '82', + nom: 'Tarn-et-Garonne', + region_id: '76' + }, + '83': { + id: '83', + nom: 'Var', + region_id: '93' + }, + '84': { + id: '84', + nom: 'Vaucluse', + region_id: '93' + }, + '85': { + id: '85', + nom: 'Vendée', + region_id: '52' + }, + '86': { + id: '86', + nom: 'Vienne', + region_id: '75' + }, + '87': { + id: '87', + nom: 'Haute-Vienne', + region_id: '75' + }, + '88': { + id: '88', + nom: 'Vosges', + region_id: '44' + }, + '89': { + id: '89', + nom: 'Yonne', + region_id: '27' + }, + '90': { + id: '90', + nom: 'Territoire de Belfort', + region_id: '27' + }, + '91': { + id: '91', + nom: 'Essonne', + region_id: '11' + }, + '92': { + id: '92', + nom: 'Hauts-de-Seine', + region_id: '11' + }, + '93': { + id: '93', + nom: 'Seine-Saint-Denis', + region_id: '11' + }, + '94': { + id: '94', + nom: 'Val-de-Marne', + region_id: '11' + }, + '95': { + id: '95', + nom: "Val-d'Oise", + region_id: '11' + }, + '971': { + id: '971', + nom: 'Guadeloupe', + region_id: '01' + }, + '972': { + id: '972', + nom: 'Martinique', + region_id: '02' + }, + '973': { + id: '973', + nom: 'Guyane', + region_id: '03' + }, + '974': { + id: '974', + nom: 'La Réunion', + region_id: '04' + }, + '976': { + id: '976', + nom: 'Mayotte', + region_id: '06' + } +} diff --git a/packages/common/src/region.ts b/packages/common/src/region.ts new file mode 100644 index 000000000..ea94d4fe1 --- /dev/null +++ b/packages/common/src/region.ts @@ -0,0 +1,121 @@ +export const REGION_IDS = { + Guadeloupe: '01', + Martinique: '02', + Guyane: '03', + 'La Réunion': '04', + Mayotte: '06', + 'Île-de-France': '11', + 'Centre-Val de Loire': '24', + 'Bourgogne-Franche-Comté': '27', + Normandie: '28', + 'Hauts-de-France': '32', + 'Grand Est': '44', + 'Pays de la Loire': '52', + Bretagne: '53', + 'Nouvelle-Aquitaine': '75', + Occitanie: '76', + 'Auvergne-Rhône-Alpes': '84', + "Provence-Alpes-Côte d'Azur": '93', + Corse: '94' +} as const + +export interface Region<T = RegionId> { + id: T + nom: string + pays_id: string +} + +export type RegionId = typeof REGION_IDS[keyof typeof REGION_IDS] + +export const Regions: { [key in RegionId]: Region<key> } = { + '01': { + id: '01', + nom: 'Guadeloupe', + pays_id: 'GP' + }, + '02': { + id: '02', + nom: 'Martinique', + pays_id: 'MQ' + }, + '03': { + id: '03', + nom: 'Guyane', + pays_id: 'GF' + }, + '04': { + id: '04', + nom: 'La Réunion', + pays_id: 'RE' + }, + '06': { + id: '06', + nom: 'Mayotte', + pays_id: 'YT' + }, + '11': { + id: '11', + nom: 'Île-de-France', + pays_id: 'FR' + }, + '24': { + id: '24', + nom: 'Centre-Val de Loire', + pays_id: 'FR' + }, + '27': { + id: '27', + nom: 'Bourgogne-Franche-Comté', + pays_id: 'FR' + }, + '28': { + id: '28', + nom: 'Normandie', + pays_id: 'FR' + }, + '32': { + id: '32', + nom: 'Hauts-de-France', + pays_id: 'FR' + }, + '44': { + id: '44', + nom: 'Grand Est', + pays_id: 'FR' + }, + '52': { + id: '52', + nom: 'Pays de la Loire', + pays_id: 'FR' + }, + '53': { + id: '53', + nom: 'Bretagne', + pays_id: 'FR' + }, + '75': { + id: '75', + nom: 'Nouvelle-Aquitaine', + pays_id: 'FR' + }, + '76': { + id: '76', + nom: 'Occitanie', + pays_id: 'FR' + }, + '84': { + id: '84', + nom: 'Auvergne-Rhône-Alpes', + pays_id: 'FR' + }, + '93': { + id: '93', + nom: "Provence-Alpes-Côte d'Azur", + pays_id: 'FR' + }, + '94': { + id: '94', + nom: 'Corse', + pays_id: 'FR' + } +} diff --git a/packages/ui/src/api/administrations.js b/packages/ui/src/api/administrations.js index 34cb382f4..f545fcfd2 100644 --- a/packages/ui/src/api/administrations.js +++ b/packages/ui/src/api/administrations.js @@ -2,16 +2,10 @@ import gql from 'graphql-tag' import { apiGraphQLFetch } from './_client' import { fragmentAdministration } from './fragments/administration' -import { fragmentAdministrations } from './fragments/administrations' -import { fragmentAdministrationType } from './fragments/metas' const administrationMetas = apiGraphQLFetch( gql` query AdministrationMetas { - administrationsTypes { - ...administrationType - } - regions { id nom @@ -27,8 +21,6 @@ const administrationMetas = apiGraphQLFetch( nom } } - - ${fragmentAdministrationType} ` ) @@ -70,55 +62,6 @@ const administration = apiGraphQLFetch(gql` ${fragmentAdministration} `) -const administrationsMetas = apiGraphQLFetch( - gql` - query AdministrationsMetas { - administrationsTypes { - id - nom - ordre - } - } - ` -) - -const administrations = apiGraphQLFetch(gql` - query Administrations( - $intervalle: Int - $page: Int - $colonne: String - $ordre: String - $noms: String - $typesIds: [ID] - ) { - administrations( - intervalle: $intervalle - page: $page - colonne: $colonne - ordre: $ordre - noms: $noms - typesIds: $typesIds - ) { - elements { - ...administrations - } - total - } - } - - ${fragmentAdministrations} -`) - -const administrationModifier = apiGraphQLFetch(gql` - mutation AdministrationModifier($administration: InputAdministration!) { - administrationModifier(administration: $administration) { - ...administration - } - } - - ${fragmentAdministration} -`) - const administrationTitreTypeUpdate = apiGraphQLFetch(gql` mutation AdministrationTitreTypeModifier( $administrationTitreType: InputAdministrationTitreType! @@ -202,9 +145,6 @@ const administrationTitreTypeEtapeTypeUpdate = apiGraphQLFetch(gql` export { administrationMetas, administration, - administrationsMetas, - administrations, - administrationModifier, administrationTitreTypeUpdate, administrationTitreTypeTitreStatutUpdate, administrationTitreTypeEtapeTypeUpdate, diff --git a/packages/ui/src/api/fragments/administration.js b/packages/ui/src/api/fragments/administration.js index a2774ef8b..d8dda3bd9 100644 --- a/packages/ui/src/api/fragments/administration.js +++ b/packages/ui/src/api/fragments/administration.js @@ -4,21 +4,6 @@ import { fragmentUtilisateur } from './utilisateur' const fragmentAdministration = gql` fragment administration on Administration { id - nom - type { - id - nom - } - abreviation - service - adresse1 - adresse2 - codePostal - commune - cedex - url - telephone - email emailsModification emailsLecture activitesTypesEmails { diff --git a/packages/ui/src/api/fragments/administrations.js b/packages/ui/src/api/fragments/administrations.js index bf9d88d31..8816392d7 100644 --- a/packages/ui/src/api/fragments/administrations.js +++ b/packages/ui/src/api/fragments/administrations.js @@ -22,7 +22,6 @@ const fragmentAdministrations = gql` nom abreviation service - membre type { nom } diff --git a/packages/ui/src/api/fragments/metas.js b/packages/ui/src/api/fragments/metas.js index 74700d94d..dbdceb4ff 100644 --- a/packages/ui/src/api/fragments/metas.js +++ b/packages/ui/src/api/fragments/metas.js @@ -158,14 +158,6 @@ const fragmentEtapeStatut = gql` } ` -const fragmentAdministrationType = gql` - fragment administrationType on AdministrationType { - id - nom - ordre - } -` - const fragmentReferenceType = gql` fragment referenceType on ReferenceType { id @@ -272,7 +264,6 @@ export { fragmentTitreType, fragmentDomaine, fragmentPhaseStatut, - fragmentAdministrationType, fragmentDocumentType, fragmentReferenceType, fragmentGeoSysteme, diff --git a/packages/ui/src/api/metas.js b/packages/ui/src/api/metas.js index 1841a831c..e2ebf1227 100644 --- a/packages/ui/src/api/metas.js +++ b/packages/ui/src/api/metas.js @@ -11,7 +11,6 @@ import { fragmentEtapeStatut, fragmentDevise, fragmentUnite, - fragmentAdministrationType, fragmentPermission, fragmentDocumentType, fragmentReferenceType, @@ -249,18 +248,6 @@ const devises = apiGraphQLFetch( ` ) -const administrationsTypes = apiGraphQLFetch( - gql` - query AdministrationsTypes { - administrationsTypes { - ...administrationType - } - } - - ${fragmentAdministrationType} - ` -) - const deviseModifier = apiGraphQLFetch(gql` mutation DeviseModifier($element: InputDevise!) { deviseModifier(devise: $element) { @@ -271,16 +258,6 @@ const deviseModifier = apiGraphQLFetch(gql` ${fragmentDevise} `) -const administrationTypeModifier = apiGraphQLFetch(gql` - mutation AdministrationTypeModifier($element: InputAdministrationType!) { - administrationTypeModifier(administrationType: $element) { - ...administrationType - } - } - - ${fragmentAdministrationType} -`) - const permissions = apiGraphQLFetch( gql` query Permissions { @@ -851,8 +828,6 @@ export { deviseModifier, unites, uniteModifier, - administrationsTypes, - administrationTypeModifier, permissionModifier, documentsTypes, documentTypeCreer, diff --git a/packages/ui/src/api/titres.js b/packages/ui/src/api/titres.js index 7795f7586..63b27ae34 100644 --- a/packages/ui/src/api/titres.js +++ b/packages/ui/src/api/titres.js @@ -15,12 +15,6 @@ const titreMetas = apiGraphQLFetch( referencesTypes { ...referenceType } - administrations { - elements { - id - nom - } - } } ${fragmentReferenceType} diff --git a/packages/ui/src/api/utilisateurs.js b/packages/ui/src/api/utilisateurs.js index e97590e9f..b892064d0 100644 --- a/packages/ui/src/api/utilisateurs.js +++ b/packages/ui/src/api/utilisateurs.js @@ -4,7 +4,6 @@ import { apiGraphQLFetch } from './_client' import { fragmentUtilisateur } from './fragments/utilisateur' import { fragmentPermission, fragmentTitreType } from './fragments/metas' import { fragmentEntreprises } from './fragments/entreprises' -import { fragmentAdministrations } from './fragments/administrations' const userMetas = apiGraphQLFetch( gql` @@ -40,19 +39,11 @@ const utilisateurMetas = apiGraphQLFetch( ...entreprises } } - - administrations { - elements { - ...administrations - } - } } ${fragmentPermission} ${fragmentEntreprises} - - ${fragmentAdministrations} ` ) diff --git a/packages/ui/src/components/__snapshots__/administrations.stories.storyshot b/packages/ui/src/components/__snapshots__/administrations.stories.storyshot new file mode 100644 index 000000000..deabb559f --- /dev/null +++ b/packages/ui/src/components/__snapshots__/administrations.stories.storyshot @@ -0,0 +1,5395 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Automated Storybook Snapshots Page/Administrations Default 1`] = ` +<div> + <div + class="desktop-blobs" + > + <div + class="desktop-blob-2-3" + > + <h1 + class="mt-xs mb-m cap-first" + > + administrations + </h1> + </div> + <div + class="desktop-blob-1-3" + > + + + </div> + </div> + <div + class="flex flex-direction-column rnd-s border bg-bg mb-s flex-grow" + > + <button + class="rnd-s accordion-header flex btn-alt py-s px-s" + > + <div> + + Filtres + + </div> + <div + class="flex flex-right flex-end" + > + <i + class="icon-24 icon-chevron-b" + /> + </div> + </button> + <!--v-if--> + <div + class="overflow-hidden" + > + <transition-stub> + <div + style="display: none;" + > + + <div + class="px-m" + > + <div + class="tablet-blobs mt" + > + <!--v-if--> + + + + + + + </div> + <button + class="btn-flash p-s rnd-xs full-x mb" + > + Valider + </button> + </div> + + </div> + </transition-stub> + </div> + </div> + <div + class="tablet-blobs tablet-flex-direction-reverse" + > + <div + class="tablet-blob-1-3 flex mb-s" + > + + + </div> + <div + class="tablet-blob-2-3 flex" + > + <div + class="py-m h5 bold mb-xs" + > + 131 résultats + </div> + </div> + </div> + <div + class="line-neutral width-full" + /> + <div> + <div + class="width-full-p" + > + <div + class="overflow-scroll-x mb" + > + <div + class="table" + > + <div + class="tr" + > + + <div + class="th nowrap" + > + <button + class="btn-menu full-x p-0" + > + Abréviation + <i + class="icon-24 right icon-chevron-b" + /> + </button> + </div> + <div + class="th nowrap" + > + <button + class="btn-menu full-x p-0" + > + Nom + <!--v-if--> + </button> + </div> + <div + class="th nowrap" + > + <button + class="btn-menu full-x p-0" + > + Type + <!--v-if--> + </button> + </div> + + </div> + + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + BRGM + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Bureau de recherches géologiques et minières + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Opérateur + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + BRGM - Projet Zercoa + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + BRGM - Projet Zercoa + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Opérateur + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Cacem + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Centre d'appui au contrôle de l'environnement marin + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Opérateur + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + DAJ - Ministère de l'Economie, des Finances et de la Relance + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Ministère de l'Economie, des Finances et de la Relance + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Ministère + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + DEAL - Guadeloupe + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Direction de l'environnement de l'aménagement et du logement (DEAL) - Guadeloupe + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Déal + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + DEAL - La Réunion + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Direction de l'environnement de l'aménagement et du logement (DEAL) - La Réunion + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Déal + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + DEAL - Martinique + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Direction de l'environnement de l'aménagement et du logement (DEAL) - Martinique + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Déal + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + DEAL - Mayotte + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Direction de l'environnement de l'aménagement et du logement (DEAL) - Mayotte + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Déal + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + DGALN/DEB/EARM2 + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Ministère de l'Economie, des Finances et de la Relance & Ministère de la Transition écologique + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Ministère + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + DGCL/SDFLAE/FL1 + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Ministère de la Cohésion des Territoires et des Relations avec les Collectivités Territoriales + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Ministère + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + DGEC/DE/SD2/2A + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Ministère de l'Economie, des Finances et de la Relance & Ministère de la Transition écologique + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Ministère + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + DGPR/SRT/SDRCP/BSSS + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Ministère de l'Economie, des Finances et de la Relance & Ministère de la Transition écologique + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Ministère + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + DGTM - Guyane + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Direction Générale des Territoires et de la Mer de Guyane + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Déal + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + DREAL - Auvergne-Rhône-Alpes - Siège de Lyon + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Direction régionale de l'environnement, de l'aménagement et du logement (DREAL) - Auvergne-Rhône-Alpes - Siège de Lyon + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Dréal + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + DREAL - Bourgogne-Franche-Comté - Siège de Besançon + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Direction régionale de l'environnement, de l'aménagement et du logement (DREAL) - Bourgogne-Franche-Comté - Siège de Besançon + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Dréal + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + DREAL - Bretagne + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Direction régionale de l'environnement, de l'aménagement et du logement (DREAL) - Bretagne + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Dréal + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + DREAL - Centre-Val-de-Loire + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Direction régionale de l'environnement, de l'aménagement et du logement (DREAL) - Centre-Val-de-Loire + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Dréal + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + DREAL - Corse + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Direction régionale de l'environnement, de l'aménagement et du logement (DREAL) - Corse + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Dréal + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + DREAL - Grand Est - Siège de Metz + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Direction régionale de l'environnement, de l'aménagement et du logement (DREAL) - Grand Est - Siège de Metz + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Dréal + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + DREAL - Hauts-de-France - Siège de Lille + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Direction régionale de l'environnement, de l'aménagement et du logement (DREAL) - Hauts-de-France - Siège de Lille + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Dréal + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + DREAL - Normandie - Siège de Rouen + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Direction régionale de l'environnement, de l'aménagement et du logement (DREAL) - Normandie - Siège de Rouen + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Dréal + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + DREAL - Nouvelle-Aquitaine - Siège de Poitiers + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Direction régionale de l'environnement, de l'aménagement et du logement (DREAL) - Nouvelle-Aquitaine - Siège de Poitiers + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Dréal + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + DREAL - Occitanie - Siège de Toulouse + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Direction régionale de l'environnement, de l'aménagement et du logement (DREAL) - Occitanie - Siège de Toulouse + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Dréal + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + DREAL - Pays de la Loire + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Direction régionale de l'environnement, de l'aménagement et du logement (DREAL) - Pays de la Loire + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Dréal + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + DREAL - Provence-Alpes-Côte-d'Azur + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Direction régionale de l'environnement, de l'aménagement et du logement (DREAL) - Provence-Alpes-Côte-d'Azur + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Dréal + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + DRIEE - Île-de-France + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Direction régionale et interdépartementale de l'environnement et de l'énergie (DRIEE) - Île-de-France + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Dréal + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Gendarmerie Nationale - Guyane + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Gendarmerie Nationale - Guyane + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Autorité + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + MRAE Guyane + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Mission régionale autorité environnementale de Guyane + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Autorité + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Office national des forêts + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Office national des forêts + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Opérateur + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Pôle Technique Minier de Guyane + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Pôle Technique Minier de Guyane + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Opérateur + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Ain + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Ain + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Aisne + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Aisne + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Allier + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Allier + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Alpes-de-Haute-Provence + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Alpes-de-Haute-Provence + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Alpes-Maritimes + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Alpes-Maritimes + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Ardèche + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Ardèche + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Ardennes + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Ardennes + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Ariège + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Ariège + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Aube + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Aube + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Aude + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Aude + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Aveyron + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Aveyron + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Bas-Rhin + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Bas-Rhin + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Bouches-du-Rhône + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Bouches-du-Rhône + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Calvados + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Calvados + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Cantal + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Cantal + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Charente + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Charente + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Charente-Maritime + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Charente-Maritime + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Cher + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Cher + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Corrèze + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Corrèze + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Corse-du-Sud + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Corse-du-Sud + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Côte-d'Or + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Côte-d'Or + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Côtes-d'Armor + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Côtes-d'Armor + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Creuse + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Creuse + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Deux-Sèvres + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Deux-Sèvres + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Dordogne + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Dordogne + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Doubs + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Doubs + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Drôme + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Drôme + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Essonne + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Essonne + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Eure + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Eure + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Eure-et-Loir + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Eure-et-Loir + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Finistère + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Finistère + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Gard + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Gard + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Gers + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Gers + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Gironde + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Gironde + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Guadeloupe + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Guadeloupe + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Guyane + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Guyane + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Haut-Rhin + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Haut-Rhin + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Haute-Corse + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Haute-Corse + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Haute-Garonne + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Haute-Garonne + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Haute-Loire + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Haute-Loire + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Haute-Marne + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Haute-Marne + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Haute-Saône + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Haute-Saône + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Haute-Savoie + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Haute-Savoie + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Haute-Vienne + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Haute-Vienne + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Hautes-Alpes + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Hautes-Alpes + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Hautes-Pyrénées + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Hautes-Pyrénées + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Hauts-de-Seine + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Hauts-de-Seine + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Hérault + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Hérault + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Ille-et-Vilaine + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Ille-et-Vilaine + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Indre + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Indre + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Indre-et-Loire + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Indre-et-Loire + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Isère + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Isère + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Jura + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Jura + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - La Réunion + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - La Réunion + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Landes + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Landes + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Loir-et-Cher + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Loir-et-Cher + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Loire + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Loire + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Loire-Atlantique + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Loire-Atlantique + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Loiret + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Loiret + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Lot + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Lot + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Lot-et-Garonne + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Lot-et-Garonne + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Lozère + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Lozère + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Maine-et-Loire + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Maine-et-Loire + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Manche + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Manche + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Marne + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Marne + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Martinique + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Martinique + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Mayenne + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Mayenne + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Mayotte + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Mayotte + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Meurthe-et-Moselle + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Meurthe-et-Moselle + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Meuse + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Meuse + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Morbihan + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Morbihan + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Moselle + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Moselle + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Nièvre + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Nièvre + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Nord + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Nord + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Oise + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Oise + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Orne + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Orne + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Pas-de-Calais + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Pas-de-Calais + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Puy-de-Dôme + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Puy-de-Dôme + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Pyrénées-Atlantiques + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Pyrénées-Atlantiques + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Pyrénées-Orientales + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Pyrénées-Orientales + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Rhône + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Rhône + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Saône-et-Loire + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Saône-et-Loire + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Sarthe + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Sarthe + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Savoie + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Savoie + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Seine-et-Marne + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Seine-et-Marne + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Seine-Maritime + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Seine-Maritime + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Seine-Saint-Denis + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Seine-Saint-Denis + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Somme + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Somme + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Tarn + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Tarn + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Tarn-et-Garonne + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Tarn-et-Garonne + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Territoire de Belfort + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Territoire de Belfort + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Val-d'Oise + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Val-d'Oise + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Val-de-Marne + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Val-de-Marne + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Var + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Var + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Vaucluse + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Vaucluse + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Vendée + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Vendée + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Vienne + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Vienne + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Vosges + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Vosges + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Yonne + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Yonne + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture - Yvelines + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture - Yvelines + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + <router-link + class="tr tr-link text-decoration-none" + to="[object Object]" + > + + <div + class="td" + > + <span + class="" + > + Préfecture de police de Paris + </span> + </div> + <div + class="td" + > + <span + class="h6" + > + Préfecture de police de Paris + </span> + </div> + <div + class="td" + > + <span + class="bold cap-first small mb--xs" + > + <span + class="bg-neutral py-xxs px-xs py-xxs px-xs rnd-xs color-bg box" + > + + Préfecture + + </span> + </span> + </div> + + </router-link> + + </div> + </div> + </div> + <!--v-if--> + </div> +</div> +`; diff --git a/packages/ui/src/components/administration.vue b/packages/ui/src/components/administration.vue index 4cdf81ed4..93efd4b2b 100644 --- a/packages/ui/src/components/administration.vue +++ b/packages/ui/src/components/administration.vue @@ -10,12 +10,6 @@ <span class="cap-first">{{ administration.nom }}</span> </template> - <template v-if="administration.modification" #buttons> - <button class="btn py-s px-m" @click="editPopupOpen"> - <i class="icon-24 icon-pencil" /> - </button> - </template> - <template #sub> <div class="px-m pt-m border-b-s"> <div class="tablet-blobs"> @@ -24,7 +18,7 @@ </div> <div class="tablet-blob-3-4"> <p class="word-break"> - {{ administration.type.nom }} + {{ type }} </p> </div> </div> @@ -183,7 +177,6 @@ import Accordion from './_ui/accordion.vue' import Loader from './_ui/loader.vue' import Table from './_ui/table.vue' -import AdministrationEditPopup from './administration/edit-popup.vue' import AdministrationPermission from './administration/permissions.vue' import AdministrationActiviteTypeEmail from './administration/activites-types-emails.vue' @@ -192,6 +185,10 @@ import { utilisateursLignesBuild } from './utilisateurs/table' import { permissionsCheck } from '@/utils' +import { + ADMINISTRATION_TYPES, + Administrations +} from 'camino-common/src/administrations' export default { components: { @@ -210,7 +207,18 @@ export default { computed: { administration() { - return this.$store.state.administration.element + const element = this.$store.state.administration.element + return { ...element, ...Administrations[this.$route.params.id] } + }, + + type() { + const typeId = this.administration?.typeId + + if (typeId) { + return ADMINISTRATION_TYPES[typeId].nom + } + + return '' }, utilisateurs() { @@ -226,7 +234,7 @@ export default { }, loaded() { - return !!this.administration + return !!this.$store.state.administration.element }, activitesTypes() { @@ -258,32 +266,6 @@ export default { await this.$store.dispatch('administration/get', this.$route.params.id) }, - editPopupOpen() { - const administration = { - id: this.administration.id, - typeId: this.administration.type.id, - nom: this.administration.nom, - abreviation: this.administration.abreviation, - service: this.administration.service, - url: this.administration.url, - email: this.administration.email, - telephone: this.administration.telephone, - adresse1: this.administration.adresse1, - adresse2: this.administration.adresse2, - codePostal: this.administration.codePostal, - commune: this.administration.commune, - cedex: this.administration.cedex, - departementId: - this.administration.departement && this.administration.departement.id, - regionId: this.administration.region && this.administration.region.id - } - - this.$store.commit('popupOpen', { - component: AdministrationEditPopup, - props: { administration } - }) - }, - permissionsCheck(user, permissions) { return permissionsCheck(user, permissions) }, diff --git a/packages/ui/src/components/administration/edit-popup.vue b/packages/ui/src/components/administration/edit-popup.vue deleted file mode 100644 index ba77b4cae..000000000 --- a/packages/ui/src/components/administration/edit-popup.vue +++ /dev/null @@ -1,360 +0,0 @@ -<template> - <Popup :messages="messages"> - <template #header> - <div> - <h2> - {{ creation ? "Ajout d'une " : "Modification de l'" }}administration - </h2> - </div> - </template> - - <div class="tablet-blobs"> - <div class="tablet-blob-1-3 tablet-pt-s pb-s"> - <h5>Nom</h5> - </div> - <div class="mb tablet-blob-2-3"> - <input v-model="administration.nom" type="text" class="p-s" /> - </div> - </div> - - <hr /> - - <div class="tablet-blobs"> - <div class="tablet-blob-1-3 tablet-pt-s pb-s"> - <h5>Type</h5> - </div> - <div class="mb tablet-blob-2-3"> - <select v-model="administration.typeId" class="p-s"> - <option - v-for="type in types" - :key="type.id" - :value="type.id" - :disabled="administration.typeId === type.id" - > - {{ type.nom }} - </option> - </select> - </div> - </div> - - <hr /> - - <div class="tablet-blobs"> - <div class="tablet-blob-1-3 tablet-pt-s pb-s"> - <h5>Abréviation</h5> - </div> - <div class="mb tablet-blob-2-3"> - <input v-model="administration.abreviation" type="text" class="p-s" /> - </div> - </div> - - <hr /> - - <div class="tablet-blobs"> - <div class="tablet-blob-1-3 tablet-pt-s pb-s"> - <h5 class="mb-0">Service</h5> - <p class="h6 italic mb-0">Optionnel</p> - </div> - <div class="mb tablet-blob-2-3"> - <input v-model="administration.service" type="text" class="p-s" /> - </div> - </div> - - <hr /> - - <div class="tablet-blobs"> - <div class="tablet-blob-1-3 tablet-pt-s pb-s"> - <h5 class="mb-0">Téléphone</h5> - <p class="h6 italic mb-0">Optionnel</p> - </div> - <div class="mb tablet-blob-2-3"> - <input - v-model="administration.telephone" - type="text" - class="p-s" - placeholder="0100000000" - /> - </div> - </div> - - <hr /> - <div class="tablet-blobs"> - <div class="tablet-blob-1-3 tablet-pt-s pb-s"> - <h5 class="mb-0">Adresse électronique</h5> - <p class="h6 italic mb-0">Optionnel</p> - </div> - <div class="mb tablet-blob-2-3"> - <input - v-model="administration.email" - type="text" - class="p-s" - placeholder="email@domain.tld" - /> - </div> - </div> - - <hr /> - <div class="tablet-blobs"> - <div class="tablet-blob-1-3 tablet-pt-s pb-s"> - <h5 class="mb-0">Site internet</h5> - <p class="h6 italic mb-0">Optionnel</p> - </div> - <div class="mb tablet-blob-2-3"> - <input - v-model="administration.url" - type="text" - class="p-s" - placeholder="http://…" - /> - </div> - </div> - - <hr /> - - <div class="tablet-blobs"> - <div class="tablet-blob-1-3 tablet-pt-s pb-s"> - <h5 class="mb-0">Adresse 1</h5> - <p class="h6 italic mb-0">Optionnel</p> - </div> - <div class="mb tablet-blob-2-3"> - <input v-model="administration.adresse1" type="text" class="p-s" /> - </div> - </div> - - <hr /> - - <div class="tablet-blobs"> - <div class="tablet-blob-1-3 tablet-pt-s pb-s"> - <h5 class="mb-0">Adresse 2</h5> - <p class="h6 italic mb-0">Optionnel</p> - </div> - <div class="mb tablet-blob-2-3"> - <input v-model="administration.adresse2" type="text" class="p-s" /> - </div> - </div> - - <hr /> - - <div class="tablet-blobs"> - <div class="tablet-blob-1-3 tablet-pt-s pb-s"> - <h5 class="mb-0">Code Postal</h5> - <p class="h6 italic mb-0">Optionnel</p> - </div> - <div class="mb tablet-blob-2-3"> - <input v-model="administration.codePostal" type="text" class="p-s" /> - </div> - </div> - - <hr /> - - <div class="tablet-blobs"> - <div class="tablet-blob-1-3 tablet-pt-s pb-s"> - <h5 class="mb-0">Commune</h5> - <p class="h6 italic mb-0">Optionnel</p> - </div> - <div class="mb tablet-blob-2-3"> - <input v-model="administration.commune" type="text" class="p-s" /> - </div> - </div> - - <hr /> - - <div class="tablet-blobs"> - <div class="tablet-blob-1-3 tablet-pt-s pb-s"> - <h5 class="mb-0">Cedex</h5> - <p class="h6 italic mb-0">Optionnel</p> - </div> - <div class="mb tablet-blob-2-3"> - <input v-model="administration.cedex" type="text" class="p-s" /> - </div> - </div> - - <hr /> - - <div class="tablet-blobs"> - <div class="tablet-blob-1-3 tablet-pt-s pb-s"> - <h5 class="mb-0">Administration locale</h5> - <p class="h6 italic mb-0">Optionnel</p> - </div> - <div class="mb tablet-blob-2-3"> - <p class="mb-s"> - <label v-for="lien in liens" :key="lien.id" class="mr-s"> - <input - v-model="lienCurrent" - :name="lien.id" - :value="lien.id" - type="radio" - class="p-s" - /> - {{ lien.nom }} - </label> - </p> - - <p class="h6 italic mb-0"> - Un utilisateur d'une administration locale peut créer et modifier le - contenu des titres du territoire concerné. - </p> - </div> - </div> - - <div v-if="lienCurrent === 'departement'" class="tablet-blobs"> - <div class="tablet-blob-1-3 tablet-pt-s pb-s"> - <h5 class="mb-0">Département</h5> - </div> - <div class="mb tablet-blob-2-3"> - <select v-model="administration.departementId" class="p-s"> - <option - v-for="departement in departements" - :key="departement.id" - :value="departement.id" - :disabled="administration.departementId === departement.id" - > - {{ departement.nom }} - </option> - </select> - </div> - </div> - - <div v-if="lienCurrent === 'region'" class="tablet-blobs"> - <div class="tablet-blob-1-3 tablet-pt-s pb-s"> - <h5 class="mb-0">Région</h5> - </div> - <div class="mb tablet-blob-2-3"> - <select v-model="administration.regionId" class="p-s"> - <option - v-for="region in regions" - :key="region.id" - :value="region.id" - :disabled="administration.regionId === region.id" - > - {{ region.nom }} - </option> - </select> - </div> - </div> - - <template #footer> - <div class="tablet-blobs"> - <div class="tablet-blob-1-3 mb tablet-mb-0"> - <button - v-if="!loading" - class="btn-border rnd-xs p-s full-x" - @click="cancel" - > - Annuler - </button> - </div> - <div class="tablet-blob-2-3"> - <button - v-if="!loading" - ref="save-button" - class="btn btn-primary" - @click="save" - > - Enregistrer - </button> - <div v-else class="p-s full-x bold">Enregistrement en cours…</div> - </div> - </div> - </template> - </Popup> -</template> - -<script> -import Popup from '../_ui/popup.vue' - -export default { - name: 'CaminoAdministrationEditPopup', - - components: { - Popup - }, - - props: { - administration: { type: Object, default: () => ({}) }, - creation: { type: Boolean, default: false } - }, - - data() { - return { - liens: [ - { id: 'aucun', nom: 'Aucun' }, - { id: 'departement', nom: 'Département' }, - { id: 'region', nom: 'Région' } - ], - lienCurrent: 'aucun' - } - }, - - computed: { - loading() { - return this.$store.state.popup.loading - }, - - messages() { - return this.$store.state.popup.messages - }, - - departements() { - return this.$store.state.administration.metas.departements - }, - - regions() { - return this.$store.state.administration.metas.regions - }, - - types() { - return this.$store.state.administration.metas.types - } - }, - - created() { - if (this.administration.regionId) { - this.lienCurrent = 'region' - } else if (this.administration.departementId) { - this.lienCurrent = 'departement' - } - - document.addEventListener('keyup', this.keyup) - }, - - beforeUnmount() { - document.removeEventListener('keyup', this.keyup) - }, - - methods: { - async save() { - const administration = JSON.parse(JSON.stringify(this.administration)) - - if (this.lienCurrent === 'region') { - administration.departementId = null - } else if (this.lienCurrent === 'departement') { - administration.regionId = null - } else { - administration.departementId = null - administration.regionId = null - } - - await this.$store.dispatch('administration/update', administration) - }, - - cancel() { - this.errorsRemove() - this.$store.commit('popupClose') - }, - - keyup(e) { - if ((e.which || e.keyCode) === 27) { - this.cancel() - } else if ((e.which || e.keyCode) === 13) { - this.$refs['save-button'].focus() - this.save() - } - }, - - errorsRemove() { - this.$store.commit('popupMessagesRemove') - } - } -} -</script> diff --git a/packages/ui/src/components/administration/permissions.vue b/packages/ui/src/components/administration/permissions.vue index ecd548f75..90c64a7d0 100644 --- a/packages/ui/src/components/administration/permissions.vue +++ b/packages/ui/src/components/administration/permissions.vue @@ -143,7 +143,7 @@ </div> </div> - <div v-if="administration.type.id" class="mb-xxl"> + <div v-if="administration.typeId" class="mb-xxl"> <h3>Restrictions de l'édition des titres, démarches et étapes</h3> <div class="h6"> @@ -378,7 +378,7 @@ </div> </div> - <div v-if="administration.type.id" class="mb-xxl"> + <div v-if="administration.typeId" class="mb-xxl"> <h3>Restrictions de la visibilité, édition et création des étapes</h3> <div class="h6"> diff --git a/packages/ui/src/components/administrations.stories.ts b/packages/ui/src/components/administrations.stories.ts new file mode 100644 index 000000000..a93d96a1d --- /dev/null +++ b/packages/ui/src/components/administrations.stories.ts @@ -0,0 +1,22 @@ +import Administrations from './administrations.vue' +import { Meta, Story } from '@storybook/vue3' + +const meta: Meta = { + title: 'Page/Administrations', + component: Administrations, + argTypes: {} +} +export default meta + +type Props = {} + +const Template: Story<Props> = (args: Props) => ({ + components: { Administrations }, + setup() { + return { args } + }, + template: '<Administrations v-bind="args" />' +}) + +export const Default = Template.bind({}) +Default.args = {} diff --git a/packages/ui/src/components/administrations.vue b/packages/ui/src/components/administrations.vue index 915bb5fdd..224fd1f50 100644 --- a/packages/ui/src/components/administrations.vue +++ b/packages/ui/src/components/administrations.vue @@ -4,101 +4,164 @@ :filtres="filtres" :colonnes="colonnes" :lignes="lignes" - :elements="administrations" + :elements="lignes" :params="params" :metas="metas" - :total="total" - :initialized="initialized" + :total="administrations.length" + :initialized="true" @params-update="paramsUpdate" > - <template v-if="administrations.length" #downloads> - <Downloads - :formats="['csv', 'xlsx', 'ods']" - section="administrations" - class="flex-right full-x" - /> - </template> </Liste> </template> -<script> +<script setup lang="ts"> import Liste from './_common/liste.vue' -import Downloads from './_common/downloads.vue' - -import filtres from './administrations/filtres' import { - administrationsColonnes, - administrationsLignesBuild -} from './administrations/table' - -export default { - name: 'Administrations', - - components: { Liste, Downloads }, - - data() { - return { - filtres, - colonnes: administrationsColonnes - } + ADMINISTRATION_TYPES, + Administrations, + AdministrationTypeId, + sortedAdministrationTypes +} from 'camino-common/src/administrations' +import { elementsFormat } from '@/utils' +import { computed, ref } from 'vue' +import Tag from '@/components/_ui/tag.vue' +import { markRaw } from '@vue/reactivity' + +const colonnes = [ + { + id: 'abreviation', + name: 'Abréviation' }, + { + id: 'nom', + name: 'Nom' + }, + { + id: 'type', + name: 'Type' + } +] as const +const filtres = [ + { + id: 'noms', + type: 'input', + value: '', + name: 'Nom', + placeholder: `Nom de l'administration` + }, + { + id: 'typesIds', + name: 'Types', + type: 'checkboxes', + value: [], + elements: [], + elementsFormat + } +] +type ColonneId = typeof colonnes[number]['id'] +const metas = { + types: sortedAdministrationTypes +} - computed: { - user() { - return this.$store.state.user.element - }, - - administrations() { - return this.$store.state.administrations.elements - }, - - total() { - return this.$store.state.administrations.total - }, - - params() { - return this.$store.state.administrations.params - }, - - metas() { - return this.$store.state.administrations.metas - }, - - lignes() { - return administrationsLignesBuild(this.administrations) - }, - - initialized() { - return this.$store.state.administrations.initialized - } +const params = ref<{ + table: { page: 0; colonne: ColonneId; ordre: 'asc' | 'desc' } + filtres: unknown +}>({ + table: { + page: 0, + colonne: 'abreviation', + ordre: 'asc' }, + filtres +}) + +const listState = ref<{ noms: string; typesIds: AdministrationTypeId[] }>({ + noms: '', + typesIds: [] +}) + +const administrations = Object.values(Administrations) + +const lignes = computed(() => { + return [...administrations] + .filter(a => { + if (listState.value.noms.length) { + if ( + !a.id.toLowerCase().includes(listState.value.noms) && + !a.nom.toLowerCase().includes(listState.value.noms) && + !a.abreviation.toLowerCase().includes(listState.value.noms) + ) { + return false + } + } - watch: { - user: 'init', + if (listState.value.typesIds.length) { + if (!listState.value.typesIds.includes(a.typeId)) { + return false + } + } - '$route.query': { - handler: function () { - this.$store.dispatch('administrations/routeUpdate') + return true + }) + .sort((a, b) => { + let first: string + let second: string + if (params.value.table.colonne === 'type') { + first = ADMINISTRATION_TYPES[a.typeId].nom + second = ADMINISTRATION_TYPES[b.typeId].nom + } else { + first = a[params.value.table.colonne] + second = b[params.value.table.colonne] } - } - }, - async created() { - await this.init() - }, + if (params.value.table.ordre === 'asc') { + return first.localeCompare(second) + } + return second.localeCompare(first) + }) + .map(administration => { + const type = ADMINISTRATION_TYPES[administration.typeId] + + const columns = { + abreviation: { value: administration.abreviation }, + nom: { value: administration.nom, class: 'h6' }, + type: { + component: markRaw(Tag), + props: { mini: true }, + class: 'mb--xs', + value: type.nom, + slot: true + } + } - unmounted() { - this.$store.commit('administrations/reset') - }, + return { + id: administration.id, + link: { name: 'administration', params: { id: administration.id } }, + columns + } + }) +}) - methods: { - async init() { - await this.$store.dispatch('administrations/init') - }, +type ParamsFiltre = { + section: 'filtres' + params: { noms: string; typesIds: AdministrationTypeId[] } +} +type ParamsTable = { + section: 'table' + params: { colonne: ColonneId; ordre: 'asc' | 'desc' } +} - async paramsUpdate(options) { - await this.$store.dispatch(`administrations/paramsSet`, options) - } +const isParamsFiltre = ( + options: ParamsFiltre | ParamsTable +): options is ParamsFiltre => options.section === 'filtres' + +const paramsUpdate = (options: ParamsFiltre | ParamsTable) => { + if (isParamsFiltre(options)) { + listState.value.noms = options.params.noms.toLowerCase() + listState.value.typesIds = options.params.typesIds + } else { + params.value.table.ordre = options.params.ordre + params.value.table.colonne = options.params.colonne } } </script> diff --git a/packages/ui/src/components/administrations/filtres.js b/packages/ui/src/components/administrations/filtres.js deleted file mode 100644 index 67a5e7649..000000000 --- a/packages/ui/src/components/administrations/filtres.js +++ /dev/null @@ -1,21 +0,0 @@ -import { elementsFormat } from '../../utils/index' - -const filtres = [ - { - id: 'noms', - type: 'input', - value: '', - name: 'Nom', - placeholder: `Nom de l'administration` - }, - { - id: 'typesIds', - name: 'Types', - type: 'checkboxes', - value: [], - elements: [], - elementsFormat - } -] - -export default filtres diff --git a/packages/ui/src/components/administrations/table.js b/packages/ui/src/components/administrations/table.js deleted file mode 100644 index c1cd0d343..000000000 --- a/packages/ui/src/components/administrations/table.js +++ /dev/null @@ -1,40 +0,0 @@ -import { markRaw } from '@vue/reactivity' -import Tag from '../_ui/tag.vue' - -const administrationsColonnes = [ - { - id: 'abreviation', - name: 'Abréviation' - }, - { - id: 'nom', - name: 'Nom' - }, - { - id: 'type', - name: 'Type' - } -] - -const administrationsLignesBuild = administrations => - administrations.map(administration => { - const columns = { - abreviation: { value: administration.abreviation }, - nom: { value: administration.nom, class: 'h6' }, - type: { - component: markRaw(Tag), - props: { mini: true }, - class: 'mb--xs', - value: administration.type.nom, - slot: true - } - } - - return { - id: administration.id, - link: { name: 'administration', params: { id: administration.id } }, - columns - } - }) - -export { administrationsColonnes, administrationsLignesBuild } diff --git a/packages/ui/src/components/titre/edit-popup.vue b/packages/ui/src/components/titre/edit-popup.vue index b02d21ce5..16f2206fe 100644 --- a/packages/ui/src/components/titre/edit-popup.vue +++ b/packages/ui/src/components/titre/edit-popup.vue @@ -76,7 +76,7 @@ > <select v-model="administration.id" class="p-s mr-s"> <option v-for="a in administrations" :key="a.id" :value="a.id"> - {{ a.nom }} + {{ a.abreviation }} </option> </select> <div class="flex-right"> @@ -130,6 +130,7 @@ import Popup from '../_ui/popup.vue' import TitreTypeSelect from '../_common/titre-type-select.vue' +import { sortedAdministrations } from 'camino-common/src/administrations' export default { name: 'CaminoDemarcheEditPopup', @@ -171,7 +172,7 @@ export default { }, administrations() { - return this.$store.state.titre.metas.administrations + return sortedAdministrations }, complete() { diff --git a/packages/ui/src/components/utilisateur.vue b/packages/ui/src/components/utilisateur.vue index 980dfb5c5..11e723963 100644 --- a/packages/ui/src/components/utilisateur.vue +++ b/packages/ui/src/components/utilisateur.vue @@ -174,7 +174,7 @@ <div class="tablet-blob-3-4"> <ul class="list-prefix"> <li v-for="a in utilisateur.administrations" :key="a.id"> - {{ `${a.nom}${a.service ? ` - ${a.service}` : ''}` }} + {{ `${a.abreviation}${a.service ? ` - ${a.service}` : ''}` }} </li> </ul> </div> diff --git a/packages/ui/src/components/utilisateur/edit-popup.vue b/packages/ui/src/components/utilisateur/edit-popup.vue index 5bdfee1f4..d64cde1c8 100644 --- a/packages/ui/src/components/utilisateur/edit-popup.vue +++ b/packages/ui/src/components/utilisateur/edit-popup.vue @@ -193,48 +193,28 @@ <div v-if="utilisateurIsAdministration"> <hr /> <h3 class="mb-s">Administrations</h3> - <div - v-for="(administration, n) in utilisateur.administrations" - :key="n" - > - <div - v-if="administrationsDisabledIds.includes(administration.id)" - class="p-s bg-alt mb-s" + + <div class="flex full-x mb"> + <select + id="cmn-utilisateur-edit-popup-administration-select" + v-model="utilisateur.administrations[0]" + class="p-s mr-s" > - {{ administrationNameFind(administration.id) }} - </div> - <div v-else class="flex full-x mb"> - <select - id="cmn-utilisateur-edit-popup-administration-select" - v-model="utilisateur.administrations[n]" - class="p-s mr-s" - :class="{ - '': !administrationsDisabledIds.includes(administration.id) - }" - :disabled=" - administrationsDisabledIds.includes(administration.id) - " + <option + v-for="a in administrations" + :key="a.id" + :value="{ id: a.id }" > - <option - v-for="a in administrationsFiltered" - :key="a.id" - :value="{ id: a.id }" - :disabled=" - utilisateur.administrations.find(({ id }) => id === a.id) || - administrationsDisabledIds.includes(a.id) - " - > - {{ `${a.abreviation}` }} - </option> - </select> - <div class="flex-right"> - <button - class="btn py-s px-m rnd-xs" - @click="administrationRemove(n)" - > - <i class="icon-24 icon-minus" /> - </button> - </div> + {{ `${a.abreviation}` }} + </option> + </select> + <div class="flex-right"> + <button + class="btn py-s px-m rnd-xs" + @click="administrationRemove(n)" + > + <i class="icon-24 icon-minus" /> + </button> </div> </div> @@ -300,6 +280,7 @@ import { permissionsCheck } from '@/utils' import Popup from '../_ui/popup.vue' import Loader from '../_ui/loader.vue' +import { sortedAdministrations } from 'camino-common/src/administrations' export default { name: 'CaminoUtilisateurEditPopup', @@ -347,7 +328,7 @@ export default { }, administrations() { - return this.$store.state.utilisateur.metas.administrations + return sortedAdministrations }, user() { @@ -400,24 +381,6 @@ export default { return ['admin', 'editeur', 'lecteur'].includes( this.utilisateur.permissionId ) - }, - - administrationsDisabledIds() { - return this.administrations.reduce((res, a) => { - if (!a.membre && !this.permissionsCheck(this.user, ['super'])) { - res.push(a.id) - } - - return res - }, []) - }, - - administrationsFiltered() { - const a = this.permissionsCheck(this.user, ['super']) - ? this.administrations - : this.administrations.filter(a => a.membre) - - return a } }, diff --git a/packages/ui/src/components/utilisateurs.vue b/packages/ui/src/components/utilisateurs.vue index d976a36cb..920352dd5 100644 --- a/packages/ui/src/components/utilisateurs.vue +++ b/packages/ui/src/components/utilisateurs.vue @@ -42,6 +42,7 @@ import { utilisateursColonnes, utilisateursLignesBuild } from './utilisateurs/table' +import { sortedAdministrations } from 'camino-common/src/administrations' export default { name: 'Utilisateurs', @@ -70,7 +71,10 @@ export default { }, metas() { - return this.$store.state.utilisateurs.metas + return { + ...this.$store.state.utilisateurs.metas, + administration: sortedAdministrations + } }, params() { diff --git a/packages/ui/src/store/administration.js b/packages/ui/src/store/administration.js index 89ec40c6e..8097a8ca7 100644 --- a/packages/ui/src/store/administration.js +++ b/packages/ui/src/store/administration.js @@ -1,7 +1,6 @@ import { administration, administrationMetas, - administrationModifier, administrationTitreTypeUpdate, administrationTitreTypeTitreStatutUpdate, administrationTitreTypeEtapeTypeUpdate, @@ -15,7 +14,6 @@ const state = { element: null, metas: { domaines: [], - types: [], regions: [], departements: [], titresStatuts: [], @@ -68,31 +66,6 @@ const actions = { } }, - async update({ commit, dispatch }, administration) { - try { - commit('popupMessagesRemove', null, { root: true }) - commit('popupLoad', null, { root: true }) - commit('loadingAdd', 'administrationUpdate', { root: true }) - const data = await administrationModifier({ administration }) - - commit('popupClose', null, { root: true }) - await dispatch( - 'reload', - { name: 'administration', id: data.id }, - { root: true } - ) - dispatch( - 'messageAdd', - { value: `l'administration a été mise à jour`, type: 'success' }, - { root: true } - ) - } catch (e) { - commit('popupMessageAdd', { value: e, type: 'error' }, { root: true }) - } finally { - commit('loadingRemove', 'administrationUpdate', { root: true }) - } - }, - async titreTypeUpdate({ commit, dispatch }, administrationTitreType) { try { commit('loadingAdd', 'administrationTitreTypeUpdate', { @@ -273,9 +246,7 @@ const actions = { const mutations = { metasSet(state, data) { Object.keys(data).forEach(id => { - if (id === 'administrationsTypes') { - state.metas.types = data[id] - } else if (id === 'statuts') { + if (id === 'statuts') { state.metas.titresStatuts = data[id] } else { state.metas[id] = data[id] diff --git a/packages/ui/src/store/administration.test.js b/packages/ui/src/store/administration.test.js index e34274043..4038b9901 100644 --- a/packages/ui/src/store/administration.test.js +++ b/packages/ui/src/store/administration.test.js @@ -26,7 +26,6 @@ describe("état de l'administration consultée", () => { element: null, metas: { domaines: [], - types: [], regions: [], departements: [], titresStatuts: [], @@ -85,47 +84,6 @@ describe("état de l'administration consultée", () => { expect(store.state.administration.element).toBeNull() }) - test('récupère les métas pour éditer une administration', async () => { - const apiMock = api.administrationMetas.mockResolvedValue({ - administrationsTypes: [ - { id: 'admin-1', nom: 'Opérateur' }, - { id: 'admin-2', nom: 'Déal' } - ], - regions: [ - { id: 1, nom: 'région 1' }, - { id: 2, nom: 'région 2' } - ], - departements: [ - { id: 1, nom: 'département 1' }, - { id: 2, nom: 'département 2' } - ] - }) - - await store.dispatch('administration/init') - - expect(apiMock).toHaveBeenCalled() - expect(store.state.administration.metas).toEqual({ - types: [ - { id: 'admin-1', nom: 'Opérateur' }, - { id: 'admin-2', nom: 'Déal' } - ], - regions: [ - { id: 1, nom: 'région 1' }, - { id: 2, nom: 'région 2' } - ], - departements: [ - { id: 1, nom: 'département 1' }, - { id: 2, nom: 'département 2' } - ], - domaines: [], - titresStatuts: [], - etapesTypes: [], - activitesTypes: [] - }) - - expect(mutations.loadingRemove).toHaveBeenCalled() - }) - test("retourne une erreur si l'API retourne une erreur lors de la récupération des métas", async () => { const apiMock = api.administrationMetas.mockRejectedValue( new Error('erreur api') @@ -138,34 +96,6 @@ describe("état de l'administration consultée", () => { expect(mutations.popupMessageAdd).toHaveBeenCalled() }) - test('modifie une administration', async () => { - const apiMock = api.administrationModifier.mockResolvedValue({ - id: 71, - nom: 'nom admin' - }) - - await store.dispatch('administration/update', { id: 71, nom: 'nom admin' }) - - expect(apiMock).toHaveBeenCalledWith({ - administration: { nom: 'nom admin', id: 71 } - }) - expect(mutations.popupClose).toHaveBeenCalled() - }) - - test("retourne une erreur si l'API retourne une erreur lors de la modification d'une administration", async () => { - const apiMock = api.administrationModifier.mockRejectedValue( - new Error('erreur api') - ) - - await store.dispatch('administration/update', { id: 71, nom: 'nom admin' }) - - expect(apiMock).toHaveBeenCalledWith({ - administration: { nom: 'nom admin', id: 71 } - }) - - expect(mutations.popupMessageAdd).toHaveBeenCalled() - }) - test('récupère les métas pour éditer les permissions', async () => { const apiMock = api.administrationPermissionsMetas.mockResolvedValue({ domaines: [{ id: 'm', nom: 'minéraux et métaux' }], @@ -177,7 +107,6 @@ describe("état de l'administration consultée", () => { expect(apiMock).toHaveBeenCalled() expect(store.state.administration.metas).toEqual({ - types: [], regions: [], departements: [], activitesTypes: [], diff --git a/packages/ui/src/store/administrations.js b/packages/ui/src/store/administrations.js deleted file mode 100644 index 450826e88..000000000 --- a/packages/ui/src/store/administrations.js +++ /dev/null @@ -1,54 +0,0 @@ -import { administrations, administrationsMetas } from '../api/administrations' -import { listeActionsBuild, listeMutations } from './_liste-build.js' - -const state = { - elements: [], - total: 0, - metas: { - types: [] - }, - definitions: [ - { id: 'page', type: 'number', min: 0 }, - { id: 'intervalle', type: 'number', min: 10, max: 500 }, - { id: 'colonne', type: 'string', values: ['nom', 'type', 'abreviation'] }, - { id: 'ordre', type: 'string', values: ['asc', 'desc'] }, - { id: 'typesIds', type: 'strings', values: [] }, - { id: 'noms', type: 'string' } - ], - params: { - table: { page: 1, intervalle: 200, ordre: 'asc', colonne: null }, - filtres: { noms: '', typesIds: [] } - }, - initialized: false -} - -const actions = listeActionsBuild( - 'administrations', - 'administrations', - administrations, - administrationsMetas -) - -const mutations = Object.assign({}, listeMutations, { - metasSet(state, data) { - const metas = { types: data } - Object.keys(metas).forEach(id => { - const paramsIds = ['typesIds'] - - state.metas[id] = metas[id] - - paramsIds.forEach(paramId => { - const definition = state.definitions.find(p => p.id === paramId) - - definition.values = metas[id].map(e => e.id) - }) - }) - } -}) - -export default { - namespaced: true, - state, - actions, - mutations -} diff --git a/packages/ui/src/store/administrations.test.js b/packages/ui/src/store/administrations.test.js deleted file mode 100644 index c1e57b404..000000000 --- a/packages/ui/src/store/administrations.test.js +++ /dev/null @@ -1,46 +0,0 @@ -import { createApp } from 'vue' -import { createStore } from 'vuex' -import administrations from './administrations' - -jest.mock('../api/administrations', () => ({ - administrations: jest.fn(), - administrationsMetas: jest.fn() -})) - -console.info = jest.fn() - -describe("liste d'administrations", () => { - let store - - beforeEach(() => { - administrations.state = { - metas: { types: [] }, - definitions: [{ id: 'typesIds', type: 'strings', values: [] }] - } - - store = createStore({ - modules: { administrations } - }) - - const app = createApp({}) - app.use(store) - }) - - test('enregistre les métas', () => { - store.commit('administrations/metasSet', [ - { id: 'ope', nom: 'opérateurs' }, - { id: 'dea', nom: 'déal' } - ]) - - expect(store.state.administrations.metas).toEqual({ - types: [ - { id: 'ope', nom: 'opérateurs' }, - { id: 'dea', nom: 'déal' } - ] - }) - - expect(store.state.administrations.definitions).toEqual([ - { id: 'typesIds', type: 'strings', values: ['ope', 'dea'] } - ]) - }) -}) diff --git a/packages/ui/src/store/index.js b/packages/ui/src/store/index.js index 7d330dedd..cf7494ed2 100644 --- a/packages/ui/src/store/index.js +++ b/packages/ui/src/store/index.js @@ -18,7 +18,6 @@ import utilisateurs from './utilisateurs' import entreprise from './entreprise' import entreprises from './entreprises' import administration from './administration' -import administrations from './administrations' import metas from './metas' import meta from './meta' import user from './user' @@ -43,7 +42,6 @@ const modules = { entreprise, entreprises, administration, - administrations, meta, metas, user, diff --git a/packages/ui/src/store/index.test.js b/packages/ui/src/store/index.test.js index 0a947b9ba..0f019c611 100644 --- a/packages/ui/src/store/index.test.js +++ b/packages/ui/src/store/index.test.js @@ -18,7 +18,6 @@ jest.mock('./utilisateurs', () => ({ utilisateurs: jest.fn() })) jest.mock('./entreprises', () => ({ entreprises: jest.fn() })) jest.mock('./entreprise', () => ({ entreprise: jest.fn() })) jest.mock('./administration', () => ({ administration: jest.fn() })) -jest.mock('./administrations', () => ({ administrations: jest.fn() })) jest.mock('./user', () => ({ user: jest.fn() })) jest.mock('./titre-activite', () => ({ titreActivite: jest.fn() })) jest.mock('./titre-activite-edition', () => ({ diff --git a/packages/ui/src/store/metas-definitions.js b/packages/ui/src/store/metas-definitions.js index f8e564b73..9afb06db7 100644 --- a/packages/ui/src/store/metas-definitions.js +++ b/packages/ui/src/store/metas-definitions.js @@ -19,8 +19,6 @@ import { deviseModifier, unites, uniteModifier, - administrationsTypes, - administrationTypeModifier, permissions, permissionModifier, documentsTypes, @@ -564,16 +562,6 @@ const metasIndex = { } ] }, - 'administrations-types': { - get: administrationsTypes, - update: administrationTypeModifier, - nom: 'Types des administrations', - colonnes: [ - { id: 'id', nom: 'Id' }, - { id: 'nom', nom: 'Nom', type: String }, - { id: 'ordre', nom: 'Ordre', type: Number } - ] - }, permissions: { get: permissions, update: permissionModifier, diff --git a/packages/ui/src/store/titre.js b/packages/ui/src/store/titre.js index 4b93c5ac1..27b241c10 100644 --- a/packages/ui/src/store/titre.js +++ b/packages/ui/src/store/titre.js @@ -13,8 +13,7 @@ const state = { element: null, metas: { referencesTypes: [], - domaines: [], - administrations: [] + domaines: [] }, opened: { etapes: {}, @@ -68,9 +67,7 @@ const actions = { commit('loadingAdd', 'titreInit', { root: true }) const data = await titreMetas() - - commit('metasSet', { referencesTypes: data.referencesTypes }) - commit('metasSet', { administrations: data.administrations.elements }) + commit('metasSet', { referencesTypes: data }) } catch (e) { commit('popupMessageAdd', { value: e, type: 'error' }, { root: true }) } finally { diff --git a/packages/ui/src/store/titre.test.js b/packages/ui/src/store/titre.test.js index 2f122f1da..6ed1dda07 100644 --- a/packages/ui/src/store/titre.test.js +++ b/packages/ui/src/store/titre.test.js @@ -64,12 +64,10 @@ describe('état du titre sélectionné', () => { }) test('récupère les métas pour éditer un titre', async () => { - const apiMock = api.titreMetas.mockResolvedValueOnce({ - referencesTypes: [ - { id: 'ifr', nom: 'Ifremer' }, - { id: 'dge', nom: 'DGEC' } - ] - }) + const apiMock = api.titreMetas.mockResolvedValueOnce([ + { id: 'ifr', nom: 'Ifremer' }, + { id: 'dge', nom: 'DGEC' } + ]) await store.dispatch('titre/init') diff --git a/packages/ui/src/store/utilisateur.js b/packages/ui/src/store/utilisateur.js index 9908ae3f4..50858191c 100644 --- a/packages/ui/src/store/utilisateur.js +++ b/packages/ui/src/store/utilisateur.js @@ -15,8 +15,7 @@ const state = { element: null, metas: { permissions: [], - entreprises: [], - administrations: [] + entreprises: [] }, metasLoaded: false } @@ -247,7 +246,7 @@ const mutations = { metasSet(state, data) { Object.keys(data).forEach(id => { - if (id === 'entreprises' || id === 'administrations') { + if (id === 'entreprises') { state.metas[id] = data[id].elements } else { state.metas[id] = data[id] diff --git a/packages/ui/src/store/utilisateur.test.js b/packages/ui/src/store/utilisateur.test.js index 83d8ab3e6..eaa691b1e 100644 --- a/packages/ui/src/store/utilisateur.test.js +++ b/packages/ui/src/store/utilisateur.test.js @@ -33,8 +33,7 @@ describe("état de l'utilisateur consulté", () => { element: null, metas: { permissions: [], - entreprises: [], - administrations: [] + entreprises: [] }, metasLoaded: false } @@ -83,8 +82,7 @@ describe("état de l'utilisateur consulté", () => { { id: 'w', nom: 'granulats' }, { id: 'c', nom: 'carrières' } ], - entreprises: { elements: ['ent-1'] }, - administrations: { elements: ['adm-1'] } + entreprises: { elements: ['ent-1'] } }) await store.dispatch('utilisateur/init') @@ -95,8 +93,7 @@ describe("état de l'utilisateur consulté", () => { { id: 'w', nom: 'granulats' }, { id: 'c', nom: 'carrières' } ], - entreprises: ['ent-1'], - administrations: ['adm-1'] + entreprises: ['ent-1'] }) expect(mutations.loadingRemove).toHaveBeenCalled() diff --git a/packages/ui/src/store/utilisateurs.js b/packages/ui/src/store/utilisateurs.js index bef5a4041..ff460a8f2 100644 --- a/packages/ui/src/store/utilisateurs.js +++ b/packages/ui/src/store/utilisateurs.js @@ -6,7 +6,6 @@ const state = { total: 0, metas: { permission: [], - administration: [], entreprise: [] }, definitions: [ @@ -66,11 +65,6 @@ const mutations = Object.assign({}, listeMutations, { paramId = 'entrepriseIds' // l'API renvoie les entreprises dans une propriété 'elements' - data[id] = data[id].elements - } else if (id === 'administrations') { - metaId = 'administration' - paramId = 'administrationIds' - data[id] = data[id].elements } diff --git a/packages/ui/src/store/utilisateurs.test.js b/packages/ui/src/store/utilisateurs.test.js index ee78a94d8..8e6087f4e 100644 --- a/packages/ui/src/store/utilisateurs.test.js +++ b/packages/ui/src/store/utilisateurs.test.js @@ -16,7 +16,6 @@ describe('liste des utilisateurs', () => { utilisateurs.state = { metas: { permission: [], - administration: [], entreprise: [] }, definitions: [ @@ -60,26 +59,15 @@ describe('liste des utilisateurs', () => { total: 4 } - const administrations = { - elements: [ - { - id: 'dre-nouvelle-aquitaine-01', - nom: "Direction régionale de l'environnement, de l'aménagement et du logement (DREAL) - Nouvelle-Aquitaine - Siège de Poitiers" - }, - { id: 'ope-onf-973-01', nom: 'Office national des forêts' } - ] - } store.commit('utilisateurs/metasSet', { permissions, entreprises, - administrations, truc: {} }) expect(store.state.utilisateurs.metas).toEqual({ permission: permissions, - entreprise: entreprises.elements, - administration: administrations.elements + entreprise: entreprises.elements }) expect(store.state.utilisateurs.definitions).toEqual([ @@ -87,7 +75,7 @@ describe('liste des utilisateurs', () => { { id: 'administrationIds', type: 'strings', - values: ['dre-nouvelle-aquitaine-01', 'ope-onf-973-01'] + values: [] }, { id: 'entrepriseIds', -- GitLab