Skip to content

Commit

Permalink
chore(api): refactor checkIsDFFReadyToBeSentToCertificationAuthorityB…
Browse files Browse the repository at this point in the history
…yId to use only essential inputs
  • Loading branch information
ThomasDos committed Nov 12, 2024
1 parent 2e128ee commit 1518fda
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,25 @@ const unsafeResolvers = {
aapDecision,
eligibilityRequirement,
}),
isReadyToBeSentToCertificationAuthority: (
dematerializedFeasibilityFile: DematerializedFeasibilityFile,
) =>
isReadyToBeSentToCertificationAuthority: ({
attachmentsPartComplete,
certificationPartComplete,
competenceBlocsPartCompletion,
prerequisitesPartComplete,
aapDecision,
eligibilityRequirement,
swornStatementFileId,
candidateConfirmationAt,
}: DematerializedFeasibilityFile) =>
checkIsDFFReadyToBeSentToCertificationAuthorityById({
dematerializedFeasibilityFile,
attachmentsPartComplete,
certificationPartComplete,
competenceBlocsPartCompletion,
prerequisitesPartComplete,
aapDecision,
eligibilityRequirement,
swornStatementFileId,
candidateConfirmationAt,
}),
swornStatementFile: ({
swornStatementFileId,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,30 @@
import { DematerializedFeasibilityFile } from "@prisma/client";
import {
CompetenceBlocsPartCompletionEnum,
DFFDecision,
DFFEligibilityRequirement,
} from "@prisma/client";

export const checkIsDFFReadyToBeSentToCertificationAuthorityById = async ({
dematerializedFeasibilityFile,
}: {
dematerializedFeasibilityFile: DematerializedFeasibilityFile;
}) => {
const {
attachmentsPartComplete,
certificationPartComplete,
competenceBlocsPartCompletion,
prerequisitesPartComplete,
aapDecision,
swornStatementFileId,
candidateConfirmationAt,
eligibilityRequirement,
} = dematerializedFeasibilityFile;
type CheckIsDFFReadyToBeSentToCertificationAuthorityByIdArgs = {
attachmentsPartComplete: boolean;
certificationPartComplete: boolean;
competenceBlocsPartCompletion: CompetenceBlocsPartCompletionEnum;
prerequisitesPartComplete: boolean;
aapDecision: DFFDecision | null;
eligibilityRequirement: DFFEligibilityRequirement | null;
swornStatementFileId: string | null;
candidateConfirmationAt: Date | null;
};

export const checkIsDFFReadyToBeSentToCertificationAuthorityById = async ({
attachmentsPartComplete,
certificationPartComplete,
competenceBlocsPartCompletion,
prerequisitesPartComplete,
aapDecision,
eligibilityRequirement,
swornStatementFileId,
candidateConfirmationAt,
}: CheckIsDFFReadyToBeSentToCertificationAuthorityByIdArgs) => {
let isDFFReadyToBeSentToCertificationAuthority =
attachmentsPartComplete &&
certificationPartComplete &&
Expand Down

0 comments on commit 1518fda

Please sign in to comment.