Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🎨 Use domain/core list instead of adapter for query lister dépots gf #1694

Merged
merged 3 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions packages/applications/bootstrap/src/setupLauréat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
consulterCahierDesChargesChoisiAdapter,
listerAbandonsAdapter,
listerAbandonsPourPorteurAdapter,
listerDépôtsEnCoursGarantiesFinancièresAdapter,
récupérerRégionDreal,
} from '@potentiel-infrastructure/domain-adapters';
import { getModèleRéponseAbandon } from '@potentiel-infrastructure/document-builder';
Expand All @@ -32,7 +31,6 @@ export const setupLauréat = async () => {
buildModèleRéponseAbandon: getModèleRéponseAbandon,
listerAbandons: listerAbandonsAdapter,
récupérerRégionDreal: récupérerRégionDreal,
listerDépôtsEnCoursGarantiesFinancières: listerDépôtsEnCoursGarantiesFinancièresAdapter,
});

AbandonProjector.register();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
consulterCahierDesChargesChoisiAdapter,
listerAbandonsAdapter,
listerAbandonsPourPorteurAdapter,
listerDépôtsEnCoursGarantiesFinancièresAdapter,
récupérerRégionDreal,
} from '@potentiel-infrastructure/domain-adapters';
import { getModèleRéponseAbandon } from '@potentiel-infrastructure/document-builder';
Expand All @@ -25,7 +24,6 @@ registerLauréatQueries({
buildModèleRéponseAbandon: getModèleRéponseAbandon,
listerAbandons: listerAbandonsAdapter,
récupérerRégionDreal: récupérerRégionDreal,
listerDépôtsEnCoursGarantiesFinancières: listerDépôtsEnCoursGarantiesFinancièresAdapter,
});

registerLauréatUseCases({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const mapToListProps = (
misÀJourLe: dernièreMiseÀJour.date.formatter(),
type: getGarantiesFinancièresTypeLabel(type.type),
dateÉchéance: dateÉchéance?.formatter(),
régionProjet: régionProjet.join(' / '),
régionProjet,
}),
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,12 @@ import {
import { DocumentProjet } from '@potentiel-domain/document';
import { IdentifiantUtilisateur, Role } from '@potentiel-domain/utilisateur';
import { Option } from '@potentiel-librairies/monads';

export type ListerDépôtsEnCoursGarantiesFinancièresPort = (args: {
where: {
appelOffre?: string;
};
pagination: {
page: number;
itemsPerPage: number;
};
région?: string;
}) => Promise<{
items: ReadonlyArray<DépôtEnCoursGarantiesFinancièresEntity>;
currentPage: number;
itemsPerPage: number;
totalItems: number;
}>;
import { List } from '@potentiel-domain/core';

type DépôtEnCoursGarantiesFinancièresListItemReadModel = {
identifiantProjet: IdentifiantProjet.ValueType;
nomProjet: string;
régionProjet: ReadonlyArray<string>;
régionProjet: string;
appelOffre: string;
période: string;
famille?: string;
Expand Down Expand Up @@ -68,12 +53,12 @@ export type ListerDépôtsEnCoursGarantiesFinancièresQuery = Message<
>;

export type ListerDépôtsEnCoursGarantiesFinancièresDependencies = {
listerDépôtsEnCoursGarantiesFinancières: ListerDépôtsEnCoursGarantiesFinancièresPort;
list: List;
récupérerRégionDreal: CommonPort.RécupérerRégionDrealPort;
};

export const registerListerDépôtsEnCoursGarantiesFinancièresQuery = ({
listerDépôtsEnCoursGarantiesFinancières,
list,
récupérerRégionDreal,
}: ListerDépôtsEnCoursGarantiesFinancièresDependencies) => {
const handler: MessageHandler<ListerDépôtsEnCoursGarantiesFinancièresQuery> = async ({
Expand All @@ -94,12 +79,13 @@ export const registerListerDépôtsEnCoursGarantiesFinancièresQuery = ({

const where = {
...(appelOffre && { appelOffre }),
...(région && { régionProjet: région }),
};

const result = await listerDépôtsEnCoursGarantiesFinancières({
const result = await list<DépôtEnCoursGarantiesFinancièresEntity>({
type: 'depot-en-cours-garanties-financieres',
where,
pagination,
région,
});

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export type DépôtEnCoursGarantiesFinancièresEntity = Entity<
{
identifiantProjet: string;
nomProjet: string;
régionProjet: Array<string>;
régionProjet: string;
appelOffre: string;
période: string;
famille?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export type GarantiesFinancièresEntity = Entity<
{
identifiantProjet: string;
nomProjet: string;
régionProjet: Array<string>;
régionProjet: string;
appelOffre: string;
période: string;
famille?: string;
Expand Down
4 changes: 0 additions & 4 deletions packages/domain/lauréat/src/garantiesFinancières/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { ModifierDépôtGarantiesFinancièresEnCoursUseCase } from './dépôt/mo
import {
ListerDépôtsEnCoursGarantiesFinancièresQuery,
ListerDépôtsEnCoursGarantiesFinancièresReadModel,
ListerDépôtsEnCoursGarantiesFinancièresPort,
} from './dépôt/lister/listerDépôtsEnCoursGarantiesFinancières.query';

import { ImporterTypeGarantiesFinancièresUseCase } from './importer/importerTypeGarantiesFinancières.usecase';
Expand Down Expand Up @@ -78,6 +77,3 @@ export * as StatutDépôtGarantiesFinancières from './statutDépôtGarantiesFin
// Projections
export * from './garantiesFinancières.entity';
export * from './dépôtEnCoursGarantiesFinancières.entity';

// Ports
export { ListerDépôtsEnCoursGarantiesFinancièresPort };

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion packages/infrastructure/domain-adapters/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
export * from './projet';
export * from './utilisateur';
export * from './abandon';
export * from './garanties-financieres';
export * as DocumentAdapter from './document/document.adapter';
export * as CandidatureAdapter from './candidature/candidature.adapter';
export * as TâcheAdapter from './tâche/tâche.adapter';
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const register = () => {
appelOffre: '',
période: '',
famille: undefined,
régionProjet: [],
régionProjet: '',
actuelles: undefined,
dépôts: [],
};
Expand All @@ -63,7 +63,7 @@ export const register = () => {
appelOffre: '',
période: '',
famille: undefined,
régionProjet: [],
régionProjet: '',
dépôt: {
type: '',
dateÉchéance: '',
Expand Down Expand Up @@ -107,7 +107,7 @@ export const register = () => {
appelOffre: Option.isSome(projet) ? projet.appelOffre : `N/A`,
période: Option.isSome(projet) ? projet.période : `N/A`,
famille: Option.isSome(projet) ? projet.famille : undefined,
régionProjet: Option.isSome(projet) ? [...projet.localité.région.split(' / ')] : [],
régionProjet: Option.isSome(projet) ? projet.localité.région : '',
};
};

Expand Down
Loading