Skip to content

Commit

Permalink
🎨 Changement reaction
Browse files Browse the repository at this point in the history
  • Loading branch information
VioMrqs committed Oct 8, 2024
1 parent a356361 commit 66f8c07
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 12 deletions.
12 changes: 12 additions & 0 deletions packages/domain/lauréat/src/notifier/notifierLauréat.command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Message, MessageHandler, mediator } from 'mediateur';

import { LoadAggregate } from '@potentiel-domain/core';
import { DateTime, Email, IdentifiantProjet } from '@potentiel-domain/common';
import { Candidature } from '@potentiel-domain/candidature';

import { loadLauréatFactory } from '../lauréat.aggregate';

Expand All @@ -20,6 +21,17 @@ export const registerNotifierLauréatCommand = (loadAggregate: LoadAggregate) =>
const handler: MessageHandler<NotifierLauréatCommand> = async (payload) => {
const Lauréat = await loadLauréatAggregate(payload.identifiantProjet, false);
await Lauréat.notifier(payload);
await mediator.send<Candidature.NotifierCandidatureUseCase>({
type: 'Candidature.UseCase.NotifierCandidature',
data: {
identifiantProjetValue: payload.identifiantProjet.formatter(),
notifiéeLeValue: payload.notifiéLe.formatter(),
notifiéeParValue: payload.notifiéPar.formatter(),
attestationValue: {
format: 'application/pdf',
},
},
});
};

mediator.register('Lauréat.Command.NotifierLauréat', handler);
Expand Down
12 changes: 0 additions & 12 deletions packages/domain/période/src/notifier/notifierPériode.command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,6 @@ export const registerNotifierPériodeCommand = (loadAggregate: LoadAggregate) =>
const candidature = await loadCandidature(identifiantCandidature);

try {
await mediator.send<Candidature.NotifierCandidatureUseCase>({
type: 'Candidature.UseCase.NotifierCandidature',
data: {
identifiantProjetValue: identifiantCandidature.formatter(),
notifiéeLeValue: notifiéeLe.formatter(),
notifiéeParValue: notifiéePar.formatter(),
attestationValue: {
format: 'application/pdf',
},
},
});

if (candidature.statut?.estClassé()) {
await mediator.send<Lauréat.NotifierLauréatUseCase>({
type: 'Lauréat.UseCase.NotifierLauréat',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Message, MessageHandler, mediator } from 'mediateur';

import { LoadAggregate } from '@potentiel-domain/core';
import { DateTime, Email, IdentifiantProjet } from '@potentiel-domain/common';
import { Candidature } from '@potentiel-domain/candidature';

import { loadÉliminéFactory } from '../éliminé.aggregate';

Expand All @@ -20,6 +21,17 @@ export const registerNotifierÉliminéCommand = (loadAggregate: LoadAggregate) =
const handler: MessageHandler<NotifierÉliminéCommand> = async (payload) => {
const éliminé = await loadÉliminéAggregate(payload.identifiantProjet, false);
await éliminé.notifier(payload);
await mediator.send<Candidature.NotifierCandidatureUseCase>({
type: 'Candidature.UseCase.NotifierCandidature',
data: {
identifiantProjetValue: payload.identifiantProjet.formatter(),
notifiéeLeValue: payload.notifiéLe.formatter(),
notifiéeParValue: payload.notifiéPar.formatter(),
attestationValue: {
format: 'application/pdf',
},
},
});
};

mediator.register('Éliminé.Command.NotifierÉliminé', handler);
Expand Down

0 comments on commit 66f8c07

Please sign in to comment.