diff --git a/api/db/migrations/20241126144339_create-cover-rate-feature.js b/api/db/migrations/20241126144339_create-cover-rate-feature.js new file mode 100644 index 00000000000..a9d4323d341 --- /dev/null +++ b/api/db/migrations/20241126144339_create-cover-rate-feature.js @@ -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 }; diff --git a/api/db/seeds/data/common/constants.js b/api/db/seeds/data/common/constants.js index 253e130b177..0b6e98f9608 100644 --- a/api/db/seeds/data/common/constants.js +++ b/api/db/seeds/data/common/constants.js @@ -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; @@ -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, diff --git a/api/db/seeds/data/common/feature-builder.js b/api/db/seeds/data/common/feature-builder.js index 58b64e63908..e524457a1fd 100644 --- a/api/db/seeds/data/common/feature-builder.js +++ b/api/db/seeds/data/common/feature-builder.js @@ -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, @@ -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(); }; diff --git a/api/db/seeds/data/common/organization-builder.js b/api/db/seeds/data/common/organization-builder.js index ce10daa8dcb..a938d366fa9 100644 --- a/api/db/seeds/data/common/organization-builder.js +++ b/api/db/seeds/data/common/organization-builder.js @@ -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, @@ -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({ diff --git a/api/src/shared/domain/constants.js b/api/src/shared/domain/constants.js index 23a15aad419..a297ad99364 100644 --- a/api/src/shared/domain/constants.js +++ b/api/src/shared/domain/constants.js @@ -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 = {