Skip to content

Commit

Permalink
🔀 Intégration des modifications de la release 3.30 (#2227)
Browse files Browse the repository at this point in the history
  • Loading branch information
JulienPavon authored Sep 20, 2024
2 parents fc26dfb + 38b0bf8 commit 4058cfc
Show file tree
Hide file tree
Showing 23 changed files with 496 additions and 230 deletions.
323 changes: 317 additions & 6 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
"node": "^20.0.0"
},
"dependencies": {
"isomorphic-dompurify": "^2.15.0",
"prettier-plugin-gherkin": "^2.3.0",
"ts-pattern": "^5.1.1"
}
Expand Down
1 change: 1 addition & 0 deletions packages/applications/bootstrap/src/setupTâche.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ const registerTâcheRaccordementSaga = async () => {
'RéférenceDossierRacordementModifiée-V1',
'GestionnaireRéseauRaccordementModifié-V1',
'GestionnaireRéseauInconnuAttribué-V1',
'RaccordementSupprimé-V1',
],
eventHandler: async (event) => {
await mediator.publish<TâcheRaccordementSaga.Execute>({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,15 @@ const mapToCertificateData = ({
return {};
}

const potentielId = [
candidature.identifiantProjet.appelOffre,
candidature.identifiantProjet.période,
candidature.identifiantProjet.famille,
candidature.identifiantProjet.numéroCRE,
]
.filter(Boolean)
.join('-');

return {
validateur: {
fullName: utilisateur.nomComplet,
Expand All @@ -103,7 +112,7 @@ const mapToCertificateData = ({

notifiedOn: new Date(notifiéLe).getTime(),
isClasse: candidature.statut.estClassé(),
potentielId: candidature.identifiantProjet.formatter().replaceAll('#', '-'),
potentielId,

nomProjet: candidature.nomProjet,
adresseProjet: [candidature.localité.adresse1, candidature.localité.adresse2]
Expand Down
4 changes: 2 additions & 2 deletions packages/applications/legacy/src/config/logger.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ logger.on('infoLog', (message: string) => {
getLogger().info(message);
});

logger.on('warningLog', (message: string) => {
getLogger().warn(message);
logger.on('warningLog', (message: string, context: Record<string, string>) => {
getLogger().warn(message, context);
});

logger.on('errorLog', (exception: Error | string) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { Raccordement } from '@potentiel-domain/reseau';
import { AchèvementRéelDTO } from '../../modules/frise';
import { Option } from '@potentiel-libraries/monads';
import { User } from '../../entities';
import { logger } from '../../core/utils';
const schema = yup.object({
params: yup.object({ projectId: yup.string().required() }),
});
Expand Down Expand Up @@ -60,8 +61,14 @@ v1Router.get(
safeAsyncHandler(
{
schema,
onError: ({ request, response }) =>
notFoundResponse({ request, response, ressourceTitle: 'Projet' }),
onError: ({ request, response, error }) => {
logger.warning(`Error in project details handler`, {
errorName: error?.name,
errorMessage: error?.message,
errorStackTrace: error?.stack,
});
return notFoundResponse({ request, response, ressourceTitle: 'Projet' });
},
},
async (request, response) => {
const { user } = request;
Expand Down Expand Up @@ -98,6 +105,11 @@ v1Router.get(
const rawProjet = await getProjectDataForProjectPage({ projectId, user });

if (rawProjet.isErr()) {
logger.warning(`Error in getProjectDataForProjectPage`, {
errorName: rawProjet.error?.name,
errorMessage: rawProjet.error?.message,
errorStackTrace: rawProjet.error?.stack,
});
return notFoundResponse({ request, response, ressourceTitle: 'Projet' });
}

Expand Down Expand Up @@ -126,6 +138,11 @@ v1Router.get(
const rawProjectEventList = await getProjectEvents({ projectId: projet.id, user });

if (rawProjectEventList.isErr()) {
logger.warning(`Error fetching project events`, {
errorName: rawProjectEventList.error?.name,
errorMessage: rawProjectEventList.error?.message,
errorStackTrace: rawProjectEventList.error?.stack,
});
return notFoundResponse({ request, response, ressourceTitle: 'Projet' });
}

Expand Down Expand Up @@ -253,7 +270,7 @@ const getAlertesRaccordement = async ({
data: { identifiantProjetValue: identifiantProjet.formatter() },
});

if(Option.isSome(dossiersRaccordement)) {
if (Option.isSome(dossiersRaccordement) && !!dossiersRaccordement.dossiers[0]) {
if (
CDC2022Choisi &&
dossiersRaccordement.dossiers[0].référence.estÉgaleÀ(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { sanitize } from 'isomorphic-dompurify';

import routes from '../../routes';
import { v1Router } from '../v1Router';
import { createUser, créerProfilUtilisateur } from '../../config';
Expand All @@ -9,8 +11,14 @@ import { EmailAlreadyUsedError } from '../../modules/shared';

const schema = yup.object({
body: yup.object({
firstname: yup.string().required('Ce champ est obligatoire'),
lastname: yup.string().required('Ce champ est obligatoire'),
firstname: yup
.string()
.required('Ce champ est obligatoire')
.transform((value) => sanitize(value)),
lastname: yup
.string()
.required('Ce champ est obligatoire')
.transform((value) => sanitize(value)),
email: yup
.string()
.required('Ce champ est obligatoire')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import { IdentifiantProjet } from '@potentiel-domain/common';

export type TimelineProps = {
projectEventList: ProjectEventListDTO;
identifiantProjet: IdentifiantProjet.RawType
identifiantProjet: IdentifiantProjet.RawType;
};

type ItemProps =
Expand All @@ -67,7 +67,7 @@ export const Timeline = ({
events,
project: { status },
},
identifiantProjet
identifiantProjet,
}: TimelineProps) => {
const itemProps: ItemProps[] = [
extractDesignationItemProps(events, status, identifiantProjet),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,54 +1,62 @@
import React from 'react';
import { ItemDate, PastIcon, ItemTitle, ContentArea } from '.';
import { DesignationItemProps } from '../helpers/extractDesignationItemProps';
import { DownloadLink } from '../..';
import { afficherDate } from '../../../helpers';
import { Routes } from '@potentiel-applications/routes';
import { DownloadLink, DownloadLinkButton } from '../../UI';
import { DesignationItemProps } from '../helpers';

// TODO: revoir cette partie
// en trouvant la date de génération (date de notification) ?

export const DesignationItem = ({
certificate,
role,
date,
projectStatus,
}: DesignationItemProps) => (
<>
<PastIcon />
<ContentArea>
<ItemDate date={date} />
<ItemTitle title="Notification des résultats" />
{certificate ? (
<Certificate {...{ certificate, role, projectStatus }} />
) : (
role === 'porteur-projet' && <span>Votre attestation sera disponible sous 24h</span>
)}
</ContentArea>
</>
);
identifiantProjet,
}: DesignationItemProps) => {
return (
<>
<PastIcon />
<ContentArea>
<ItemDate date={date} />
<ItemTitle title="Notification des résultats" />
<Attestation projectStatus={projectStatus} identifiantProjet={identifiantProjet} />
</ContentArea>
</>
);
};

type CertificateProps = {
certificate: Exclude<DesignationItemProps['certificate'], undefined>;
// certificate?: Exclude<DesignationItemProps['certificate'], undefined>;
projectStatus: DesignationItemProps['projectStatus'];
identifiantProjet: DesignationItemProps['identifiantProjet'];
};

const Certificate = ({ certificate, projectStatus }: CertificateProps) => {
const { status } = certificate;
const Attestation = ({ projectStatus, identifiantProjet }: CertificateProps) => {
// const { status } = certificate;

// if (status === 'not-applicable') {
// return <span>Attestation non disponible pour cette période</span>;
// }

// const { url: fileUrl, date } = certificate;

if (status === 'not-applicable') {
return <span>Attestation non disponible pour cette période</span>;
}
// const urlTitle =
// projectStatus === 'Eliminé'
// ? status === 'generated'
// ? `avis de rejet (édité`
// : `avis de rejet (transmis`
// : status === 'generated'
// ? `attestation de désignation (éditée`
// : `attestation de désignation (transmise`;

const { url: fileUrl, date } = certificate;
const urlTitle = projectStatus === 'Eliminé' ? "l'avis de rejet" : "l'attestation de désignation";

const urlTitle =
projectStatus === 'Eliminé'
? status === 'generated'
? `avis de rejet (édité`
: `avis de rejet (transmis`
: status === 'generated'
? `attestation de désignation (éditée`
: `attestation de désignation (transmise`;
return (
<DownloadLink {...{ fileUrl }}>{`Télécharger l'${urlTitle} le ${afficherDate(
date,
)})`}</DownloadLink>
<DownloadLink
fileUrl={Routes.Candidature.téléchargerAttestation(identifiantProjet)}
className="m-auto"
>
Télécharger {urlTitle}
{/* {`Télécharger l'${urlTitle}}) le ${afficherDate(date)})`} */}
</DownloadLink>
);
};

This file was deleted.

Loading

0 comments on commit 4058cfc

Please sign in to comment.