Skip to content

Commit

Permalink
[FEATURE] Activer le taux de couverture à des organisations précises (P…
Browse files Browse the repository at this point in the history
  • Loading branch information
pix-service-auto-merge authored Nov 27, 2024
2 parents ecb76e6 + 91a84dc commit 4bf51aa
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 1 deletion.
14 changes: 14 additions & 0 deletions api/db/migrations/20241126144339_create-cover-rate-feature.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { ORGANIZATION_FEATURE } from '../../src/shared/domain/constants.js';

const up = async function (knex) {
await knex('features').insert({
key: ORGANIZATION_FEATURE.COVER_RATE.key,
description: ORGANIZATION_FEATURE.COVER_RATE.description,
});
};

const down = async function (knex) {
await knex('features').where({ key: ORGANIZATION_FEATURE.COVER_RATE.key }).delete();
};

export { down, up };
2 changes: 2 additions & 0 deletions api/db/seeds/data/common/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const FEATURE_CAN_REGISTER_FOR_A_COMPLEMENTARY_CERTIFICATION_ALONE_ID = COMMON_O
const FEATURE_CAMPAIGN_EXTERNAL_ID = COMMON_OFFSET_ID + 7;
const FEATURE_ORALIZATION_ID = COMMON_OFFSET_ID + 8;
const FEATURE_ATTESTATIONS_MANAGEMENT_ID = COMMON_OFFSET_ID + 9;
const FEATURE_COVER_RATE_ID = COMMON_OFFSET_ID + 10;

//ORGANIZATIONS
const SCO_MANAGING_ORGANIZATION_ID = COMMON_OFFSET_ID;
Expand Down Expand Up @@ -85,6 +86,7 @@ export {
FEATURE_CAMPAIGN_EXTERNAL_ID,
FEATURE_CAN_REGISTER_FOR_A_COMPLEMENTARY_CERTIFICATION_ALONE_ID,
FEATURE_COMPUTE_ORGANIZATION_LEARNER_CERTIFICABILITY_ID,
FEATURE_COVER_RATE_ID,
FEATURE_LEARNER_IMPORT_ID,
FEATURE_MISSIONS_MANAGEMENT_ID,
FEATURE_MULTIPLE_SENDING_ASSESSMENT_ID,
Expand Down
6 changes: 6 additions & 0 deletions api/db/seeds/data/common/feature-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
FEATURE_CAMPAIGN_EXTERNAL_ID,
FEATURE_CAN_REGISTER_FOR_A_COMPLEMENTARY_CERTIFICATION_ALONE_ID,
FEATURE_COMPUTE_ORGANIZATION_LEARNER_CERTIFICABILITY_ID,
FEATURE_COVER_RATE_ID,
FEATURE_LEARNER_IMPORT_ID,
FEATURE_MISSIONS_MANAGEMENT_ID,
FEATURE_MULTIPLE_SENDING_ASSESSMENT_ID,
Expand Down Expand Up @@ -58,6 +59,11 @@ const featuresBuilder = async function ({ databaseBuilder }) {
key: ORGANIZATION_FEATURE.ORALIZATION_MANAGED_BY_PRESCRIBER.key,
description: ORGANIZATION_FEATURE.ORALIZATION_MANAGED_BY_PRESCRIBER.description,
});
databaseBuilder.factory.buildFeature({
id: FEATURE_COVER_RATE_ID,
key: ORGANIZATION_FEATURE.COVER_RATE.key,
description: ORGANIZATION_FEATURE.COVER_RATE.description,
});
await databaseBuilder.commit();
};

Expand Down
7 changes: 6 additions & 1 deletion api/db/seeds/data/common/organization-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
DEFAULT_PASSWORD,
FEATURE_ATTESTATIONS_MANAGEMENT_ID,
FEATURE_COMPUTE_ORGANIZATION_LEARNER_CERTIFICABILITY_ID,
FEATURE_COVER_RATE_ID,
FEATURE_LEARNER_IMPORT_ID,
FEATURE_MULTIPLE_SENDING_ASSESSMENT_ID,
FEATURE_PLACES_MANAGEMENT_ID,
Expand Down Expand Up @@ -98,7 +99,11 @@ async function _createProOrganization(databaseBuilder) {
externalId: 'PRO_NOT_MANAGING',
adminIds: [USER_ID_ADMIN_ORGANIZATION],
memberIds: [USER_ID_MEMBER_ORGANIZATION],
features: [{ id: FEATURE_MULTIPLE_SENDING_ASSESSMENT_ID }, { id: FEATURE_PLACES_MANAGEMENT_ID }],
features: [
{ id: FEATURE_MULTIPLE_SENDING_ASSESSMENT_ID },
{ id: FEATURE_PLACES_MANAGEMENT_ID },
{ id: FEATURE_COVER_RATE_ID },
],
});

await organization.createOrganization({
Expand Down
4 changes: 4 additions & 0 deletions api/src/shared/domain/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ const ORGANIZATION_FEATURE = {
description:
"Permet au prescripteur qui travail sur PixJunior d'activer ou désactiver l'oralisation pour un prescrit depuis pixOrga.",
},
COVER_RATE: {
key: 'COVER_RATE',
description: "Permet l'affichage de la page statistiques sur Pix Orga",
},
};

const CAMPAIGN_FEATURES = {
Expand Down

0 comments on commit 4bf51aa

Please sign in to comment.