Skip to content

Commit

Permalink
feat(api): added a getCertificationCompetenceBloc query to the refere…
Browse files Browse the repository at this point in the history
…ntial module
  • Loading branch information
agarbe committed Nov 11, 2024
1 parent 269f1b5 commit 6469b17
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { prismaClient } from "../../../prisma/client";

export const getCertificationCompetenceBlocById = async ({
certificationCompetenceBlocId,
}: {
certificationCompetenceBlocId: string;
}) =>
prismaClient.certificationCompetenceBloc.findUnique({
where: {
id: certificationCompetenceBlocId,
},
});
3 changes: 3 additions & 0 deletions packages/reva-api/modules/referential/referential.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,9 @@ type Query {
filters: ActiveCertificationsFiltersInput
): [Certification!]!
getCandidacyFinancingMethods: [CandidacyFinancingMethod!]!
getCertificationCompetenceBloc(
certificationCompetenceBlocId: ID!
): CertificationCompetenceBloc!
}

input UpdateCertificationInput {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import { searchCertificationsForCandidate } from "./features/searchCertification
import { getAvailableFormacodes } from "./features/getFormacodes";
import { getActiveCertifications } from "./features/getActiveCertifications";
import { getCandidacyFinancingMethods } from "./features/getCandidacyFinancingMethods";
import { getCertificationCompetenceBlocById } from "./features/getCertificationCompetenceBlocById";

const unsafeReferentialResolvers = {
Certification: {
Expand Down Expand Up @@ -129,6 +130,14 @@ const unsafeReferentialResolvers = {
},
) => getActiveCertifications(payload.filters),
getCandidacyFinancingMethods,
getCertificationCompetenceBloc: (
_: unknown,
{
certificationCompetenceBlocId,
}: {
certificationCompetenceBlocId: string;
},
) => getCertificationCompetenceBlocById({ certificationCompetenceBlocId }),
},
Mutation: {
referential_updateCertification: (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ export const referentialResolversSecurityMap = {
],

"Query.getEtablissementAsAdmin": [hasRole(["admin"])],
"Query.getCertificationCompetenceBloc": [hasRole(["admin"])],
};

0 comments on commit 6469b17

Please sign in to comment.