Skip to content

Commit

Permalink
feat(api):send decision file as email attachment when DF is admissible
Browse files Browse the repository at this point in the history
  • Loading branch information
pierreavizou committed Dec 19, 2024
1 parent 9fc6f40 commit 2f34e5b
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
deleteFile,
emptyUploadedFileStream,
getUploadedFile,
UploadedFile,
uploadFilesToS3,
} from "../../../../modules/shared/file";
import { allowFileTypeByDocumentType } from "../../../../modules/shared/file/allowFileTypes";
Expand Down Expand Up @@ -42,6 +43,7 @@ const sendFeasibilityDecisionTakenEmail = async ({
certificationAuthorityLabel,
isAutonome,
candidacyId,
decisionUploadedFile,
}: {
candidateEmail: string;
aapEmail: string;
Expand All @@ -51,6 +53,7 @@ const sendFeasibilityDecisionTakenEmail = async ({
certificationAuthorityLabel: string;
isAutonome: boolean;
candidacyId: string;
decisionUploadedFile?: UploadedFile;
}) => {
if (decision === "INCOMPLETE") {
if (isAutonome) {
Expand Down Expand Up @@ -89,13 +92,15 @@ const sendFeasibilityDecisionTakenEmail = async ({
comment: decisionComment,
certificationAuthorityLabel,
certificationName,
infoFile: decisionUploadedFile,
});
} else {
sendFeasibilityValidatedToCandidateAccompagneEmail({
email: candidateEmail,
comment: decisionComment,
certificationAuthorityLabel,
certificationName,
infoFile: decisionUploadedFile,
});
}

Expand Down Expand Up @@ -142,8 +147,9 @@ export const createOrUpdateCertificationAuthorityDecision = async ({
}

let decisionFileForDb = null;
let decisionUploadedFile;
if (decisionFile) {
const decisionUploadedFile = await getUploadedFile(decisionFile);
decisionUploadedFile = await getUploadedFile(decisionFile);
const fileId = uuidV4();
const fileAndId: {
id: string;
Expand Down Expand Up @@ -242,6 +248,7 @@ export const createOrUpdateCertificationAuthorityDecision = async ({
certificationAuthorityLabel,
isAutonome,
candidacyId,
decisionUploadedFile,
});

return getDematerializedFeasibilityFileByCandidacyId({
Expand Down

0 comments on commit 2f34e5b

Please sign in to comment.