Skip to content

Commit

Permalink
🎨 Déclencher NotifierCandidature depuis NotifierLauréat ou Eliminé (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
VioMrqs authored Oct 8, 2024
1 parent b1aadaf commit 516fc04
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.usecase.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Message, MessageHandler, mediator } from 'mediateur';

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

import { NotifierLauréatCommand } from './notifierLauréat.command';

Expand All @@ -23,6 +24,17 @@ export const registerNotifierLauréatUseCase = () => {
notifiéLeValue,
attestationValue: { format },
}) => {
await mediator.send<Candidature.NotifierCandidatureUseCase>({
type: 'Candidature.UseCase.NotifierCandidature',
data: {
identifiantProjetValue,
notifiéeLeValue: notifiéLeValue,
notifiéeParValue: notifiéParValue,
attestationValue: {
format: 'application/pdf',
},
},
});
await mediator.send<NotifierLauréatCommand>({
type: 'Lauréat.Command.NotifierLauréat',
data: {
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
@@ -1,6 +1,7 @@
import { Message, MessageHandler, mediator } from 'mediateur';

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

import { NotifierÉliminéCommand } from './notifierÉliminé.command';

Expand All @@ -23,6 +24,17 @@ export const registerNotifierÉliminéUseCase = () => {
notifiéParValue,
attestationValue: { format },
}) => {
await mediator.send<Candidature.NotifierCandidatureUseCase>({
type: 'Candidature.UseCase.NotifierCandidature',
data: {
identifiantProjetValue,
notifiéeLeValue: notifiéLeValue,
notifiéeParValue: notifiéParValue,
attestationValue: {
format: 'application/pdf',
},
},
});
await mediator.send<NotifierÉliminéCommand>({
type: 'Éliminé.Command.NotifierÉliminé',
data: {
Expand Down

0 comments on commit 516fc04

Please sign in to comment.