From 3033cff38dad9d0894aa01ade0afb202dc4a2b3b Mon Sep 17 00:00:00 2001 From: Benjamin Levesque <14175665+benjlevesque@users.noreply.github.com> Date: Mon, 6 Jan 2025 16:47:06 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9A=B0=EF=B8=8F=20Remove=20file?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain-adapters/src/projet/index.ts | 1 - .../src/projet/listerProjetForOre.adapter.ts | 58 ------------------- 2 files changed, 59 deletions(-) delete mode 100644 packages/infrastructure/domain-adapters/src/projet/listerProjetForOre.adapter.ts diff --git a/packages/infrastructure/domain-adapters/src/projet/index.ts b/packages/infrastructure/domain-adapters/src/projet/index.ts index 8dac2be33b..d03c1e52c2 100644 --- a/packages/infrastructure/domain-adapters/src/projet/index.ts +++ b/packages/infrastructure/domain-adapters/src/projet/index.ts @@ -1,3 +1,2 @@ export * from './consulterCahierDesChargesChoisi.adapter'; export * from './listerIdentifiantsProjetsParPorteur.adapter'; -export * from './listerProjetForOre.adapter'; diff --git a/packages/infrastructure/domain-adapters/src/projet/listerProjetForOre.adapter.ts b/packages/infrastructure/domain-adapters/src/projet/listerProjetForOre.adapter.ts deleted file mode 100644 index 2581c56be7..0000000000 --- a/packages/infrastructure/domain-adapters/src/projet/listerProjetForOre.adapter.ts +++ /dev/null @@ -1,58 +0,0 @@ -import format from 'pg-format'; - -import { executeSelect } from '@potentiel-libraries/pg-helpers'; -import { IdentifiantProjet } from '@potentiel-domain/common'; - -export type ProjetListéPourOREReadModel = { - legacyId: string; - identifiantProjet: string; - appelOffre: string; - période: string; - famille: string; - numéroCRE: string; - localité: { - commune: string; - codePostal: string; - }; -}; - -type Props = { - limit?: number; - offset?: number; -}; - -export const listerProjetForOreAdapter = async ({ limit, offset }: Props) => { - const selectProjectQuery = format(` - SELECT json_build_object( - 'legacyId', "id", - 'appelOffre', "appelOffreId", - 'période', "periodeId", - 'famille', "familleId", - 'numéroCRE', "numeroCRE", - 'localité', json_build_object( - 'commune', "communeProjet", - 'codePostal', "codePostalProjet" - ) - ) as value - FROM "projects" - WHERE "classe" = 'Classé' - AND "abandonedOn" = '0' - ${limit !== undefined ? `LIMIT ${limit}` : ''} - ${offset !== undefined ? `OFFSET ${limit}` : ''} -`); - - const projets = await executeSelect<{ - value: Omit; - }>(selectProjectQuery); - - const projectsWithIdentifiantProject = projets.map((projet) => { - return { - ...projet.value, - identifiantProjet: IdentifiantProjet.convertirEnValueType( - `${projet.value.appelOffre}#${projet.value.période}#${projet.value.famille}#${projet.value.numéroCRE}`, - ).formatter(), - }; - }); - - return projectsWithIdentifiantProject; -};