diff --git a/api/lib/domain/events/index.js b/api/lib/domain/events/index.js index 44ace1bb343..a9779765aea 100644 --- a/api/lib/domain/events/index.js +++ b/api/lib/domain/events/index.js @@ -27,6 +27,7 @@ import * as assessmentRepository from '../../../src/shared/infrastructure/reposi import * as assessmentResultRepository from '../../../src/shared/infrastructure/repositories/assessment-result-repository.js'; import * as challengeRepository from '../../../src/shared/infrastructure/repositories/challenge-repository.js'; import * as competenceRepository from '../../../src/shared/infrastructure/repositories/competence-repository.js'; +import * as knowledgeElementRepository from '../../../src/shared/infrastructure/repositories/knowledge-element-repository.js'; import * as organizationRepository from '../../../src/shared/infrastructure/repositories/organization-repository.js'; import * as skillRepository from '../../../src/shared/infrastructure/repositories/skill-repository.js'; import { injectDefaults } from '../../../src/shared/infrastructure/utils/dependency-injection.js'; @@ -38,7 +39,6 @@ import * as badgeAcquisitionRepository from '../../infrastructure/repositories/b import * as campaignRepository from '../../infrastructure/repositories/campaign-repository.js'; import * as complementaryCertificationCourseResultRepository from '../../infrastructure/repositories/complementary-certification-course-result-repository.js'; import * as complementaryCertificationScoringCriteriaRepository from '../../infrastructure/repositories/complementary-certification-scoring-criteria-repository.js'; -import * as knowledgeElementRepository from '../../infrastructure/repositories/knowledge-element-repository.js'; import * as targetProfileRepository from '../../infrastructure/repositories/target-profile-repository.js'; import { handleCertificationRescoring } from './handle-certification-rescoring.js'; import { handleComplementaryCertificationsScoring } from './handle-complementary-certifications-scoring.js'; diff --git a/api/lib/domain/services/certification-challenges-service.js b/api/lib/domain/services/certification-challenges-service.js index b01f81929be..abb620b377e 100644 --- a/api/lib/domain/services/certification-challenges-service.js +++ b/api/lib/domain/services/certification-challenges-service.js @@ -10,8 +10,8 @@ import { Challenge } from '../../../src/shared/domain/models/Challenge.js'; import { KnowledgeElement } from '../../../src/shared/domain/models/KnowledgeElement.js'; import * as answerRepository from '../../../src/shared/infrastructure/repositories/answer-repository.js'; import * as challengeRepository from '../../../src/shared/infrastructure/repositories/challenge-repository.js'; +import * as knowledgeElementRepository from '../../../src/shared/infrastructure/repositories/knowledge-element-repository.js'; import * as certifiableProfileForLearningContentRepository from '../../infrastructure/repositories/certifiable-profile-for-learning-content-repository.js'; -import * as knowledgeElementRepository from '../../infrastructure/repositories/knowledge-element-repository.js'; import * as learningContentRepository from '../../infrastructure/repositories/learning-content-repository.js'; const pickCertificationChallenges = async function ( diff --git a/api/lib/domain/usecases/index.js b/api/lib/domain/usecases/index.js index a0aaf4f9d94..816448fff99 100644 --- a/api/lib/domain/usecases/index.js +++ b/api/lib/domain/usecases/index.js @@ -104,6 +104,7 @@ import * as assessmentResultRepository from '../../../src/shared/infrastructure/ import * as challengeRepository from '../../../src/shared/infrastructure/repositories/challenge-repository.js'; import * as competenceRepository from '../../../src/shared/infrastructure/repositories/competence-repository.js'; import * as courseRepository from '../../../src/shared/infrastructure/repositories/course-repository.js'; +import * as knowledgeElementRepository from '../../../src/shared/infrastructure/repositories/knowledge-element-repository.js'; import * as organizationLearnerRepository from '../../../src/shared/infrastructure/repositories/organization-learner-repository.js'; import * as organizationRepository from '../../../src/shared/infrastructure/repositories/organization-repository.js'; import * as skillRepository from '../../../src/shared/infrastructure/repositories/skill-repository.js'; @@ -136,7 +137,6 @@ import * as flashAssessmentResultRepository from '../../infrastructure/repositor import * as frameworkRepository from '../../infrastructure/repositories/framework-repository.js'; import { repositories } from '../../infrastructure/repositories/index.js'; import { certificationCompletedJobRepository } from '../../infrastructure/repositories/jobs/certification-completed-job-repository.js'; -import * as knowledgeElementRepository from '../../infrastructure/repositories/knowledge-element-repository.js'; import * as learningContentRepository from '../../infrastructure/repositories/learning-content-repository.js'; import * as organizationMemberIdentityRepository from '../../infrastructure/repositories/organization-member-identity-repository.js'; import * as organizationTagRepository from '../../infrastructure/repositories/organization-tag-repository.js'; diff --git a/api/lib/domain/usecases/stages/handle-stage-acquisition.js b/api/lib/domain/usecases/stages/handle-stage-acquisition.js index 8251955df8f..f6951b7eaae 100644 --- a/api/lib/domain/usecases/stages/handle-stage-acquisition.js +++ b/api/lib/domain/usecases/stages/handle-stage-acquisition.js @@ -5,10 +5,10 @@ import * as defaultGetNewAcquiredStagesService from '../../../../src/evaluation/ import * as defaultStageAcquisitionRepository from '../../../../src/evaluation/infrastructure/repositories/stage-acquisition-repository.js'; import * as defaultStageRepository from '../../../../src/evaluation/infrastructure/repositories/stage-repository.js'; import * as defaultCampaignParticipationRepository from '../../../../src/prescription/campaign-participation/infrastructure/repositories/campaign-participation-repository.js'; +import * as defaultKnowledgeElementRepositoryRepository from '../../../../src/shared/infrastructure/repositories/knowledge-element-repository.js'; import * as defaultSkillRepository from '../../../../src/shared/infrastructure/repositories/skill-repository.js'; import * as defaultCampaignRepository from '../../../infrastructure/repositories/campaign-repository.js'; import * as defaultCampaignSkillRepository from '../../../infrastructure/repositories/campaign-skill-repository.js'; -import * as defaultKnowledgeElementRepositoryRepository from '../../../infrastructure/repositories/knowledge-element-repository.js'; import * as defaultGetMasteryPercentageService from '../../services/get-mastery-percentage-service.js'; /** diff --git a/api/lib/infrastructure/repositories/certifiable-profile-for-learning-content-repository.js b/api/lib/infrastructure/repositories/certifiable-profile-for-learning-content-repository.js index 023867f0fe5..8255142072e 100644 --- a/api/lib/infrastructure/repositories/certifiable-profile-for-learning-content-repository.js +++ b/api/lib/infrastructure/repositories/certifiable-profile-for-learning-content-repository.js @@ -2,7 +2,7 @@ import _ from 'lodash'; import { knex } from '../../../db/knex-database-connection.js'; import { CertifiableProfileForLearningContent } from '../../../src/shared/domain/models/CertifiableProfileForLearningContent.js'; -import * as knowledgeElementRepository from './knowledge-element-repository.js'; +import * as knowledgeElementRepository from '../../../src/shared/infrastructure/repositories/knowledge-element-repository.js'; const get = async function ({ id, profileDate, learningContent }) { const knowledgeElements = await knowledgeElementRepository.findUniqByUserId({ userId: id, limitDate: profileDate }); diff --git a/api/scripts/prod/compute-participation-results.js b/api/scripts/prod/compute-participation-results.js index ff80fbb4daa..fe33e778c86 100644 --- a/api/scripts/prod/compute-participation-results.js +++ b/api/scripts/prod/compute-participation-results.js @@ -6,7 +6,7 @@ import * as dotenv from 'dotenv'; dotenv.config({ path: `${__dirname}/../../.env` }); import * as campaignRepository from '../../lib/infrastructure/repositories/campaign-repository.js'; -import * as knowlegeElementSnapshotRepository from '../../lib/infrastructure/repositories/knowledge-element-snapshot-repository.js'; +import * as knowlegeElementSnapshotRepository from '../../src/prescription/campaign/infrastructure/repositories/knowledge-element-snapshot-repository.js'; import { ParticipantResultsShared } from '../../src/prescription/campaign-participation/domain/models/ParticipantResultsShared.js'; import { CampaignParticipationStatuses } from '../../src/prescription/shared/domain/constants.js'; diff --git a/api/scripts/prod/generate-knowledge-element-snapshots-for-campaigns.js b/api/scripts/prod/generate-knowledge-element-snapshots-for-campaigns.js index 2eb8de9e627..42a866803c4 100644 --- a/api/scripts/prod/generate-knowledge-element-snapshots-for-campaigns.js +++ b/api/scripts/prod/generate-knowledge-element-snapshots-for-campaigns.js @@ -3,9 +3,9 @@ import * as url from 'node:url'; import yargs from 'yargs'; import { disconnect, knex } from '../../db/knex-database-connection.js'; -import * as knowledgeElementRepository from '../../lib/infrastructure/repositories/knowledge-element-repository.js'; -import * as knowledgeElementSnapshotRepository from '../../lib/infrastructure/repositories/knowledge-element-snapshot-repository.js'; +import * as knowledgeElementSnapshotRepository from '../../src/prescription/campaign/infrastructure/repositories/knowledge-element-snapshot-repository.js'; import { AlreadyExistingEntityError } from '../../src/shared/domain/errors.js'; +import * as knowledgeElementRepository from '../../src/shared/infrastructure/repositories/knowledge-element-repository.js'; import { PromiseUtils } from '../../src/shared/infrastructure/utils/promise-utils.js'; const DEFAULT_MAX_SNAPSHOT_COUNT = 5000; diff --git a/api/src/certification/results/infrastructure/repositories/certified-profile-repository.js b/api/src/certification/results/infrastructure/repositories/certified-profile-repository.js index 8f7ee4aef32..e193acd75d2 100644 --- a/api/src/certification/results/infrastructure/repositories/certified-profile-repository.js +++ b/api/src/certification/results/infrastructure/repositories/certified-profile-repository.js @@ -4,7 +4,6 @@ import { LOCALE } from '../../../../shared/domain/constants.js'; const { FRENCH_SPOKEN } = LOCALE; import { knex } from '../../../../../db/knex-database-connection.js'; -import * as knowledgeElementRepository from '../../../../../lib/infrastructure/repositories/knowledge-element-repository.js'; import { NotFoundError } from '../../../../shared/domain/errors.js'; import { CertifiedArea, @@ -15,6 +14,7 @@ import { } from '../../../../shared/domain/read-models/CertifiedProfile.js'; import * as areaRepository from '../../../../shared/infrastructure/repositories/area-repository.js'; import * as competenceRepository from '../../../../shared/infrastructure/repositories/competence-repository.js'; +import * as knowledgeElementRepository from '../../../../shared/infrastructure/repositories/knowledge-element-repository.js'; import * as skillRepository from '../../../../shared/infrastructure/repositories/skill-repository.js'; import * as tubeRepository from '../../../../shared/infrastructure/repositories/tube-repository.js'; diff --git a/api/src/certification/shared/domain/services/certification-badges-service.js b/api/src/certification/shared/domain/services/certification-badges-service.js index 5f16db3fb21..be85525444e 100644 --- a/api/src/certification/shared/domain/services/certification-badges-service.js +++ b/api/src/certification/shared/domain/services/certification-badges-service.js @@ -5,7 +5,7 @@ import _ from 'lodash'; import * as badgeForCalculationRepository from '../../../../../lib/infrastructure/repositories/badge-for-calculation-repository.js'; import * as certifiableBadgeAcquisitionRepository from '../../../../../lib/infrastructure/repositories/certifiable-badge-acquisition-repository.js'; -import * as knowledgeElementRepository from '../../../../../lib/infrastructure/repositories/knowledge-element-repository.js'; +import * as knowledgeElementRepository from '../../../../shared/infrastructure/repositories/knowledge-element-repository.js'; import { PromiseUtils } from '../../../../shared/infrastructure/utils/promise-utils.js'; const findStillValidBadgeAcquisitions = async function ({ diff --git a/api/src/devcomp/domain/usecases/index.js b/api/src/devcomp/domain/usecases/index.js index 01be0c8ebbb..3470893b7d3 100644 --- a/api/src/devcomp/domain/usecases/index.js +++ b/api/src/devcomp/domain/usecases/index.js @@ -2,11 +2,11 @@ import { dirname, join } from 'node:path'; import { fileURLToPath } from 'node:url'; import * as campaignRepository from '../../../../lib/infrastructure/repositories/campaign-repository.js'; -import * as knowledgeElementRepository from '../../../../lib/infrastructure/repositories/knowledge-element-repository.js'; import * as targetProfileRepository from '../../../../lib/infrastructure/repositories/target-profile-repository.js'; import * as targetProfileTrainingRepository from '../../../../lib/infrastructure/repositories/target-profile-training-repository.js'; import * as userRepository from '../../../identity-access-management/infrastructure/repositories/user.repository.js'; import * as campaignParticipationRepository from '../../../prescription/campaign-participation/infrastructure/repositories/campaign-participation-repository.js'; +import * as knowledgeElementRepository from '../../../shared/infrastructure/repositories/knowledge-element-repository.js'; import * as skillRepository from '../../../shared/infrastructure/repositories/skill-repository.js'; import { injectDependencies } from '../../../shared/infrastructure/utils/dependency-injection.js'; import { importNamedExportsFromDirectory } from '../../../shared/infrastructure/utils/import-named-exports-from-directory.js'; diff --git a/api/src/devcomp/infrastructure/repositories/tutorial-repository.js b/api/src/devcomp/infrastructure/repositories/tutorial-repository.js index 5ec7ecde457..3c15d431026 100644 --- a/api/src/devcomp/infrastructure/repositories/tutorial-repository.js +++ b/api/src/devcomp/infrastructure/repositories/tutorial-repository.js @@ -1,8 +1,8 @@ import _ from 'lodash'; -import * as knowledgeElementRepository from '../../../../lib/infrastructure/repositories/knowledge-element-repository.js'; import { LOCALE } from '../../../shared/domain/constants.js'; import { NotFoundError } from '../../../shared/domain/errors.js'; +import * as knowledgeElementRepository from '../../../shared/infrastructure/repositories/knowledge-element-repository.js'; import { LearningContentRepository } from '../../../shared/infrastructure/repositories/learning-content-repository.js'; import * as skillRepository from '../../../shared/infrastructure/repositories/skill-repository.js'; import * as paginateModule from '../../../shared/infrastructure/utils/paginate.js'; diff --git a/api/src/evaluation/domain/services/get-competence-level.js b/api/src/evaluation/domain/services/get-competence-level.js index c87b7d00ace..0777aa71add 100644 --- a/api/src/evaluation/domain/services/get-competence-level.js +++ b/api/src/evaluation/domain/services/get-competence-level.js @@ -1,4 +1,4 @@ -import * as knowledgeElementRepository from '../../../../lib/infrastructure/repositories/knowledge-element-repository.js'; +import * as knowledgeElementRepository from '../../../shared/infrastructure/repositories/knowledge-element-repository.js'; import * as scoringService from './scoring/scoring-service.js'; const getCompetenceLevel = async function ({ diff --git a/api/src/evaluation/domain/usecases/index.js b/api/src/evaluation/domain/usecases/index.js index 83a899aa5fe..07b1ca9bdf2 100644 --- a/api/src/evaluation/domain/usecases/index.js +++ b/api/src/evaluation/domain/usecases/index.js @@ -2,15 +2,15 @@ import { dirname, join } from 'node:path'; import { fileURLToPath } from 'node:url'; import * as campaignRepository from '../../../../lib/infrastructure/repositories/campaign-repository.js'; -import * as knowledgeElementRepository from '../../../../lib/infrastructure/repositories/knowledge-element-repository.js'; import * as targetProfileRepository from '../../../../lib/infrastructure/repositories/target-profile-repository.js'; -import * as campaignParticipationRepository from '../../../../src/prescription/campaign-participation/infrastructure/repositories/campaign-participation-repository.js'; -import * as challengeRepository from '../../../../src/shared/infrastructure/repositories/challenge-repository.js'; +import * as campaignParticipationRepository from '../../../prescription/campaign-participation/infrastructure/repositories/campaign-participation-repository.js'; import * as targetProfileAdministrationRepository from '../../../prescription/target-profile/infrastructure/repositories/target-profile-administration-repository.js'; import * as answerRepository from '../../../shared/infrastructure/repositories/answer-repository.js'; import * as areaRepository from '../../../shared/infrastructure/repositories/area-repository.js'; import * as assessmentRepository from '../../../shared/infrastructure/repositories/assessment-repository.js'; +import * as challengeRepository from '../../../shared/infrastructure/repositories/challenge-repository.js'; import * as competenceRepository from '../../../shared/infrastructure/repositories/competence-repository.js'; +import * as knowledgeElementRepository from '../../../shared/infrastructure/repositories/knowledge-element-repository.js'; import * as skillRepository from '../../../shared/infrastructure/repositories/skill-repository.js'; import { injectDependencies } from '../../../shared/infrastructure/utils/dependency-injection.js'; import { importNamedExportsFromDirectory } from '../../../shared/infrastructure/utils/import-named-exports-from-directory.js'; diff --git a/api/src/prescription/campaign-participation/domain/usecases/index.js b/api/src/prescription/campaign-participation/domain/usecases/index.js index 09bed1cb10d..6f33966cdba 100644 --- a/api/src/prescription/campaign-participation/domain/usecases/index.js +++ b/api/src/prescription/campaign-participation/domain/usecases/index.js @@ -4,13 +4,12 @@ import { fileURLToPath } from 'node:url'; import * as badgeAcquisitionRepository from '../../../../../lib/infrastructure/repositories/badge-acquisition-repository.js'; import * as badgeForCalculationRepository from '../../../../../lib/infrastructure/repositories/badge-for-calculation-repository.js'; import * as campaignRepository from '../../../../../lib/infrastructure/repositories/campaign-repository.js'; -import * as knowledgeElementRepository from '../../../../../lib/infrastructure/repositories/knowledge-element-repository.js'; import * as learningContentRepository from '../../../../../lib/infrastructure/repositories/learning-content-repository.js'; import * as targetProfileRepository from '../../../../../lib/infrastructure/repositories/target-profile-repository.js'; import * as stageCollectionRepository from '../../../../../lib/infrastructure/repositories/user-campaign-results/stage-collection-repository.js'; -import * as badgeRepository from '../../../../../src/evaluation/infrastructure/repositories/badge-repository.js'; import * as tutorialRepository from '../../../../devcomp/infrastructure/repositories/tutorial-repository.js'; import * as compareStagesAndAcquiredStages from '../../../../evaluation/domain/services/stages/stage-and-stage-acquisition-comparison-service.js'; +import * as badgeRepository from '../../../../evaluation/infrastructure/repositories/badge-repository.js'; import * as competenceEvaluationRepository from '../../../../evaluation/infrastructure/repositories/competence-evaluation-repository.js'; import * as stageAcquisitionRepository from '../../../../evaluation/infrastructure/repositories/stage-acquisition-repository.js'; import * as stageRepository from '../../../../evaluation/infrastructure/repositories/stage-repository.js'; @@ -20,6 +19,7 @@ import { config } from '../../../../shared/config.js'; import * as areaRepository from '../../../../shared/infrastructure/repositories/area-repository.js'; import * as assessmentRepository from '../../../../shared/infrastructure/repositories/assessment-repository.js'; import * as competenceRepository from '../../../../shared/infrastructure/repositories/competence-repository.js'; +import * as knowledgeElementRepository from '../../../../shared/infrastructure/repositories/knowledge-element-repository.js'; import * as organizationLearnerRepository from '../../../../shared/infrastructure/repositories/organization-learner-repository.js'; import * as organizationRepository from '../../../../shared/infrastructure/repositories/organization-repository.js'; import { injectDependencies } from '../../../../shared/infrastructure/utils/dependency-injection.js'; diff --git a/api/src/prescription/campaign-participation/infrastructure/repositories/campaign-analysis-repository.js b/api/src/prescription/campaign-participation/infrastructure/repositories/campaign-analysis-repository.js index 5d7cfbd2dd1..bd5df846a9b 100644 --- a/api/src/prescription/campaign-participation/infrastructure/repositories/campaign-analysis-repository.js +++ b/api/src/prescription/campaign-participation/infrastructure/repositories/campaign-analysis-repository.js @@ -1,8 +1,8 @@ import _ from 'lodash'; import { knex } from '../../../../../db/knex-database-connection.js'; -import * as knowledgeElementRepository from '../../../../../lib/infrastructure/repositories/knowledge-element-repository.js'; import { CHUNK_SIZE_CAMPAIGN_RESULT_PROCESSING } from '../../../../../src/shared/infrastructure/constants.js'; +import * as knowledgeElementRepository from '../../../../shared/infrastructure/repositories/knowledge-element-repository.js'; import { CampaignAnalysis } from '../../../campaign/domain/read-models/CampaignAnalysis.js'; import { CampaignParticipationStatuses } from '../../../shared/domain/constants.js'; diff --git a/api/src/prescription/campaign-participation/infrastructure/repositories/campaign-assessment-participation-repository.js b/api/src/prescription/campaign-participation/infrastructure/repositories/campaign-assessment-participation-repository.js index 170a908c322..7b83074dc8d 100644 --- a/api/src/prescription/campaign-participation/infrastructure/repositories/campaign-assessment-participation-repository.js +++ b/api/src/prescription/campaign-participation/infrastructure/repositories/campaign-assessment-participation-repository.js @@ -2,9 +2,9 @@ import _ from 'lodash'; import { knex } from '../../../../../db/knex-database-connection.js'; import * as campaignRepository from '../../../../../lib/infrastructure/repositories/campaign-repository.js'; -import * as knowledgeElementRepository from '../../../../../lib/infrastructure/repositories/knowledge-element-repository.js'; import { NotFoundError } from '../../../../shared/domain/errors.js'; import { Assessment } from '../../../../shared/domain/models/Assessment.js'; +import * as knowledgeElementRepository from '../../../../shared/infrastructure/repositories/knowledge-element-repository.js'; import { CampaignAssessmentParticipation } from '../../domain/models/CampaignAssessmentParticipation.js'; const getByCampaignIdAndCampaignParticipationId = async function ({ campaignId, campaignParticipationId }) { diff --git a/api/src/prescription/campaign-participation/infrastructure/repositories/campaign-assessment-participation-result-repository.js b/api/src/prescription/campaign-participation/infrastructure/repositories/campaign-assessment-participation-result-repository.js index e665f3bc605..637dc6c140f 100644 --- a/api/src/prescription/campaign-participation/infrastructure/repositories/campaign-assessment-participation-result-repository.js +++ b/api/src/prescription/campaign-participation/infrastructure/repositories/campaign-assessment-participation-result-repository.js @@ -1,8 +1,8 @@ import { knex } from '../../../../../db/knex-database-connection.js'; -import * as knowledgeElementRepository from '../../../../../lib/infrastructure/repositories/knowledge-element-repository.js'; import * as learningContentRepository from '../../../../../lib/infrastructure/repositories/learning-content-repository.js'; -import { CampaignLearningContent } from '../../../../../src/shared/domain/models/CampaignLearningContent.js'; import { NotFoundError } from '../../../../shared/domain/errors.js'; +import { CampaignLearningContent } from '../../../../shared/domain/models/CampaignLearningContent.js'; +import * as knowledgeElementRepository from '../../../../shared/infrastructure/repositories/knowledge-element-repository.js'; import { CampaignAssessmentParticipationResult } from '../../domain/models/CampaignAssessmentParticipationResult.js'; const getByCampaignIdAndCampaignParticipationId = async function ({ campaignId, campaignParticipationId, locale }) { diff --git a/api/src/prescription/campaign-participation/infrastructure/repositories/campaign-participation-repository.js b/api/src/prescription/campaign-participation/infrastructure/repositories/campaign-participation-repository.js index 0d4cea31655..3a6252edcfe 100644 --- a/api/src/prescription/campaign-participation/infrastructure/repositories/campaign-participation-repository.js +++ b/api/src/prescription/campaign-participation/infrastructure/repositories/campaign-participation-repository.js @@ -1,13 +1,13 @@ import lodash from 'lodash'; import { knex } from '../../../../../db/knex-database-connection.js'; -import * as knowledgeElementRepository from '../../../../../lib/infrastructure/repositories/knowledge-element-repository.js'; -import * as knowledgeElementSnapshotRepository from '../../../../../lib/infrastructure/repositories/knowledge-element-snapshot-repository.js'; -import { Campaign } from '../../../../../src/shared/domain/models/Campaign.js'; import { constants } from '../../../../shared/domain/constants.js'; import { DomainTransaction } from '../../../../shared/domain/DomainTransaction.js'; import { NotFoundError } from '../../../../shared/domain/errors.js'; import { Assessment } from '../../../../shared/domain/models/Assessment.js'; +import { Campaign } from '../../../../shared/domain/models/Campaign.js'; +import * as knowledgeElementRepository from '../../../../shared/infrastructure/repositories/knowledge-element-repository.js'; +import * as knowledgeElementSnapshotRepository from '../../../campaign/infrastructure/repositories/knowledge-element-snapshot-repository.js'; import { CampaignParticipationStatuses, CampaignTypes } from '../../../shared/domain/constants.js'; import { CampaignParticipation } from '../../domain/models/CampaignParticipation.js'; import { AvailableCampaignParticipation } from '../../domain/read-models/AvailableCampaignParticipation.js'; diff --git a/api/src/prescription/campaign-participation/infrastructure/repositories/campaign-participation-result-repository.js b/api/src/prescription/campaign-participation/infrastructure/repositories/campaign-participation-result-repository.js index 195730b062d..80cdc423a19 100644 --- a/api/src/prescription/campaign-participation/infrastructure/repositories/campaign-participation-result-repository.js +++ b/api/src/prescription/campaign-participation/infrastructure/repositories/campaign-participation-result-repository.js @@ -1,9 +1,9 @@ import * as campaignRepository from '../../../../../lib/infrastructure/repositories/campaign-repository.js'; -import * as knowledgeElementRepository from '../../../../../lib/infrastructure/repositories/knowledge-element-repository.js'; import { CampaignParticipationResult } from '../../../../shared/domain/models/CampaignParticipationResult.js'; import * as areaRepository from '../../../../shared/infrastructure/repositories/area-repository.js'; import * as assessmentRepository from '../../../../shared/infrastructure/repositories/assessment-repository.js'; import * as competenceRepository from '../../../../shared/infrastructure/repositories/competence-repository.js'; +import * as knowledgeElementRepository from '../../../../shared/infrastructure/repositories/knowledge-element-repository.js'; import * as campaignParticipationRepository from './campaign-participation-repository.js'; const campaignParticipationResultRepository = { diff --git a/api/src/prescription/campaign-participation/infrastructure/repositories/participant-result-repository.js b/api/src/prescription/campaign-participation/infrastructure/repositories/participant-result-repository.js index 143856498eb..62ddbc370d3 100644 --- a/api/src/prescription/campaign-participation/infrastructure/repositories/participant-result-repository.js +++ b/api/src/prescription/campaign-participation/infrastructure/repositories/participant-result-repository.js @@ -3,7 +3,6 @@ import _ from 'lodash'; import { knex } from '../../../../../db/knex-database-connection.js'; import * as campaignRepository from '../../../../../lib/infrastructure/repositories/campaign-repository.js'; import * as flashAssessmentResultRepository from '../../../../../lib/infrastructure/repositories/flash-assessment-result-repository.js'; -import * as knowledgeElementRepository from '../../../../../lib/infrastructure/repositories/knowledge-element-repository.js'; import * as flash from '../../../../certification/flash-certification/domain/services/algorithm-methods/flash.js'; import * as dataFetcher from '../../../../evaluation/domain/services/algorithm-methods/data-fetcher.js'; import { convertLevelStagesIntoThresholds } from '../../../../evaluation/domain/services/stages/convert-level-stages-into-thresholds-service.js'; @@ -14,6 +13,7 @@ import * as answerRepository from '../../../../shared/infrastructure/repositorie import * as areaRepository from '../../../../shared/infrastructure/repositories/area-repository.js'; import * as challengeRepository from '../../../../shared/infrastructure/repositories/challenge-repository.js'; import * as competenceRepository from '../../../../shared/infrastructure/repositories/competence-repository.js'; +import * as knowledgeElementRepository from '../../../../shared/infrastructure/repositories/knowledge-element-repository.js'; import * as skillRepository from '../../../../shared/infrastructure/repositories/skill-repository.js'; /** diff --git a/api/src/prescription/campaign/domain/usecases/index.js b/api/src/prescription/campaign/domain/usecases/index.js index 9bea7998467..d1d2008b198 100644 --- a/api/src/prescription/campaign/domain/usecases/index.js +++ b/api/src/prescription/campaign/domain/usecases/index.js @@ -3,8 +3,6 @@ import { fileURLToPath } from 'node:url'; import * as badgeAcquisitionRepository from '../../../../../lib/infrastructure/repositories/badge-acquisition-repository.js'; import * as campaignRepository from '../../../../../lib/infrastructure/repositories/campaign-repository.js'; -import * as knowledgeElementRepository from '../../../../../lib/infrastructure/repositories/knowledge-element-repository.js'; -import * as knowledgeElementSnapshotRepository from '../../../../../lib/infrastructure/repositories/knowledge-element-snapshot-repository.js'; import * as learningContentRepository from '../../../../../lib/infrastructure/repositories/learning-content-repository.js'; import * as stageCollectionRepository from '../../../../../lib/infrastructure/repositories/user-campaign-results/stage-collection-repository.js'; import * as tutorialRepository from '../../../../devcomp/infrastructure/repositories/tutorial-repository.js'; @@ -14,6 +12,7 @@ import * as organizationFeatureApi from '../../../../organizational-entities/app import * as codeGenerator from '../../../../shared/domain/services/code-generator.js'; import * as placementProfileService from '../../../../shared/domain/services/placement-profile-service.js'; import * as competenceRepository from '../../../../shared/infrastructure/repositories/competence-repository.js'; +import * as knowledgeElementRepository from '../../../../shared/infrastructure/repositories/knowledge-element-repository.js'; import * as organizationRepository from '../../../../shared/infrastructure/repositories/organization-repository.js'; import { injectDependencies } from '../../../../shared/infrastructure/utils/dependency-injection.js'; import { importNamedExportsFromDirectory } from '../../../../shared/infrastructure/utils/import-named-exports-from-directory.js'; @@ -35,6 +34,7 @@ import * as campaignReportRepository from '../../infrastructure/repositories/cam import * as divisionRepository from '../../infrastructure/repositories/division-repository.js'; import * as groupRepository from '../../infrastructure/repositories/group-repository.js'; import { repositories as campaignRepositories } from '../../infrastructure/repositories/index.js'; +import * as knowledgeElementSnapshotRepository from '../../infrastructure/repositories/knowledge-element-snapshot-repository.js'; import * as targetProfileRepository from '../../infrastructure/repositories/target-profile-repository.js'; import * as campaignUpdateValidator from '../validators/campaign-update-validator.js'; diff --git a/api/src/prescription/campaign/infrastructure/repositories/campaign-collective-result-repository.js b/api/src/prescription/campaign/infrastructure/repositories/campaign-collective-result-repository.js index 89404616cd9..462622e7122 100644 --- a/api/src/prescription/campaign/infrastructure/repositories/campaign-collective-result-repository.js +++ b/api/src/prescription/campaign/infrastructure/repositories/campaign-collective-result-repository.js @@ -1,8 +1,8 @@ import _ from 'lodash'; import { knex } from '../../../../../db/knex-database-connection.js'; -import * as knowledgeElementRepository from '../../../../../lib/infrastructure/repositories/knowledge-element-repository.js'; import { CHUNK_SIZE_CAMPAIGN_RESULT_PROCESSING } from '../../../../shared/infrastructure/constants.js'; +import * as knowledgeElementRepository from '../../../../shared/infrastructure/repositories/knowledge-element-repository.js'; import { CampaignParticipationStatuses } from '../../../shared/domain/constants.js'; import { CampaignCollectiveResult } from '../../domain/read-models/CampaignCollectiveResult.js'; import { getLatestParticipationSharedForOneLearner } from './helpers/get-latest-participation-shared-for-one-learner.js'; diff --git a/api/lib/infrastructure/repositories/knowledge-element-snapshot-repository.js b/api/src/prescription/campaign/infrastructure/repositories/knowledge-element-snapshot-repository.js similarity index 85% rename from api/lib/infrastructure/repositories/knowledge-element-snapshot-repository.js rename to api/src/prescription/campaign/infrastructure/repositories/knowledge-element-snapshot-repository.js index 54e6a907759..ef42504cc07 100644 --- a/api/lib/infrastructure/repositories/knowledge-element-snapshot-repository.js +++ b/api/src/prescription/campaign/infrastructure/repositories/knowledge-element-snapshot-repository.js @@ -1,11 +1,11 @@ import _ from 'lodash'; -import { knex } from '../../../db/knex-database-connection.js'; -import { CampaignParticipationKnowledgeElementSnapshots } from '../../../src/prescription/shared/domain/read-models/CampaignParticipationKnowledgeElementSnapshots.js'; -import { AlreadyExistingEntityError } from '../../../src/shared/domain/errors.js'; -import { KnowledgeElement } from '../../../src/shared/domain/models/KnowledgeElement.js'; -import * as knexUtils from '../../../src/shared/infrastructure/utils/knex-utils.js'; -import { DomainTransaction } from '../DomainTransaction.js'; +import { knex } from '../../../../../db/knex-database-connection.js'; +import { DomainTransaction } from '../../../../../lib/infrastructure/DomainTransaction.js'; +import { AlreadyExistingEntityError } from '../../../../shared/domain/errors.js'; +import { KnowledgeElement } from '../../../../shared/domain/models/KnowledgeElement.js'; +import * as knexUtils from '../../../../shared/infrastructure/utils/knex-utils.js'; +import { CampaignParticipationKnowledgeElementSnapshots } from '../../../shared/domain/read-models/CampaignParticipationKnowledgeElementSnapshots.js'; function _toKnowledgeElementCollection({ snapshot } = {}) { if (!snapshot) return null; diff --git a/api/src/profile/domain/usecases/index.js b/api/src/profile/domain/usecases/index.js index 8b79e1f4212..ac42595afeb 100644 --- a/api/src/profile/domain/usecases/index.js +++ b/api/src/profile/domain/usecases/index.js @@ -1,12 +1,12 @@ import { dirname, join } from 'node:path'; import { fileURLToPath } from 'node:url'; -import * as knowledgeElementRepository from '../../../../lib/infrastructure/repositories/knowledge-element-repository.js'; import * as competenceEvaluationRepository from '../../../evaluation/infrastructure/repositories/competence-evaluation-repository.js'; import { repositories } from '../../../profile/infrastructure/repositories/index.js'; import * as profileRewardRepository from '../../../profile/infrastructure/repositories/profile-reward-repository.js'; import * as areaRepository from '../../../shared/infrastructure/repositories/area-repository.js'; import * as competenceRepository from '../../../shared/infrastructure/repositories/competence-repository.js'; +import * as knowledgeElementRepository from '../../../shared/infrastructure/repositories/knowledge-element-repository.js'; import { injectDependencies } from '../../../shared/infrastructure/utils/dependency-injection.js'; import { importNamedExportsFromDirectory } from '../../../shared/infrastructure/utils/import-named-exports-from-directory.js'; import * as attestationRepository from '../../infrastructure/repositories/attestation-repository.js'; diff --git a/api/src/shared/domain/services/placement-profile-service.js b/api/src/shared/domain/services/placement-profile-service.js index cadd0cc0b50..4c1cf267de4 100644 --- a/api/src/shared/domain/services/placement-profile-service.js +++ b/api/src/shared/domain/services/placement-profile-service.js @@ -1,14 +1,14 @@ import _ from 'lodash'; -import * as knowledgeElementRepository from '../../../../lib/infrastructure/repositories/knowledge-element-repository.js'; -import * as knowledgeElementSnapshotRepository from '../../../../lib/infrastructure/repositories/knowledge-element-snapshot-repository.js'; -import { PlacementProfile } from '../../../../src/shared/domain/models/PlacementProfile.js'; -import { UserCompetence } from '../../../../src/shared/domain/models/UserCompetence.js'; import { AlgorithmEngineVersion } from '../../../certification/shared/domain/models/AlgorithmEngineVersion.js'; import * as scoringService from '../../../evaluation/domain/services/scoring/scoring-service.js'; +import * as knowledgeElementSnapshotRepository from '../../../prescription/campaign/infrastructure/repositories/knowledge-element-snapshot-repository.js'; +import { PlacementProfile } from '../../domain/models/PlacementProfile.js'; +import { UserCompetence } from '../../domain/models/UserCompetence.js'; import * as assessmentRepository from '../../infrastructure/repositories/assessment-repository.js'; import * as assessmentResultRepository from '../../infrastructure/repositories/assessment-result-repository.js'; import * as competenceRepository from '../../infrastructure/repositories/competence-repository.js'; +import * as knowledgeElementRepository from '../../infrastructure/repositories/knowledge-element-repository.js'; import * as skillRepository from '../../infrastructure/repositories/skill-repository.js'; import { PromiseUtils } from '../../infrastructure/utils/promise-utils.js'; diff --git a/api/lib/infrastructure/repositories/knowledge-element-repository.js b/api/src/shared/infrastructure/repositories/knowledge-element-repository.js similarity index 94% rename from api/lib/infrastructure/repositories/knowledge-element-repository.js rename to api/src/shared/infrastructure/repositories/knowledge-element-repository.js index de79253c8bf..2af71e96985 100644 --- a/api/lib/infrastructure/repositories/knowledge-element-repository.js +++ b/api/src/shared/infrastructure/repositories/knowledge-element-repository.js @@ -1,9 +1,9 @@ import _ from 'lodash'; -import { knex } from '../../../db/knex-database-connection.js'; -import { KnowledgeElement } from '../../../src/shared/domain/models/KnowledgeElement.js'; -import { DomainTransaction } from '../../infrastructure/DomainTransaction.js'; -import * as knowledgeElementSnapshotRepository from './knowledge-element-snapshot-repository.js'; +import { knex } from '../../../../db/knex-database-connection.js'; +import { DomainTransaction } from '../../../../lib/infrastructure/DomainTransaction.js'; +import * as knowledgeElementSnapshotRepository from '../../../prescription/campaign/infrastructure/repositories/knowledge-element-snapshot-repository.js'; +import { KnowledgeElement } from '../../domain/models/KnowledgeElement.js'; const tableName = 'knowledge-elements'; diff --git a/api/tests/integration/domain/services/certification-challenges-service_test.js b/api/tests/integration/domain/services/certification-challenges-service_test.js index 4d42ce92b0d..59aee580485 100644 --- a/api/tests/integration/domain/services/certification-challenges-service_test.js +++ b/api/tests/integration/domain/services/certification-challenges-service_test.js @@ -1,9 +1,9 @@ import * as certificationChallengesService from '../../../../lib/domain/services/certification-challenges-service.js'; -import * as knowledgeElementRepository from '../../../../lib/infrastructure/repositories/knowledge-element-repository.js'; import { PIX_COUNT_BY_LEVEL } from '../../../../src/shared/domain/constants.js'; import * as placementProfileService from '../../../../src/shared/domain/services/placement-profile-service.js'; import * as answerRepository from '../../../../src/shared/infrastructure/repositories/answer-repository.js'; import * as challengeRepository from '../../../../src/shared/infrastructure/repositories/challenge-repository.js'; +import * as knowledgeElementRepository from '../../../../src/shared/infrastructure/repositories/knowledge-element-repository.js'; import { databaseBuilder, expect, mockLearningContent } from '../../../test-helper.js'; describe('Integration | CertificationChallengeService | pickCertificationChallenge', function () { diff --git a/api/tests/integration/infrastructure/repositories/knowledge-element-snapshot-repository_test.js b/api/tests/prescription/campaign/integration/infrastructure/repositories/knowledge-element-snapshot-repository_test.js similarity index 96% rename from api/tests/integration/infrastructure/repositories/knowledge-element-snapshot-repository_test.js rename to api/tests/prescription/campaign/integration/infrastructure/repositories/knowledge-element-snapshot-repository_test.js index c4001b5fcb8..44ec3d818e9 100644 --- a/api/tests/integration/infrastructure/repositories/knowledge-element-snapshot-repository_test.js +++ b/api/tests/prescription/campaign/integration/infrastructure/repositories/knowledge-element-snapshot-repository_test.js @@ -1,8 +1,8 @@ -import { DomainTransaction } from '../../../../lib/infrastructure/DomainTransaction.js'; -import * as knowledgeElementSnapshotRepository from '../../../../lib/infrastructure/repositories/knowledge-element-snapshot-repository.js'; -import { AlreadyExistingEntityError } from '../../../../src/shared/domain/errors.js'; -import { KnowledgeElement } from '../../../../src/shared/domain/models/KnowledgeElement.js'; -import { catchErr, databaseBuilder, domainBuilder, expect, knex } from '../../../test-helper.js'; +import { DomainTransaction } from '../../../../../../lib/infrastructure/DomainTransaction.js'; +import * as knowledgeElementSnapshotRepository from '../../../../../../src/prescription/campaign/infrastructure/repositories/knowledge-element-snapshot-repository.js'; +import { AlreadyExistingEntityError } from '../../../../../../src/shared/domain/errors.js'; +import { KnowledgeElement } from '../../../../../../src/shared/domain/models/KnowledgeElement.js'; +import { catchErr, databaseBuilder, domainBuilder, expect, knex } from '../../../../../test-helper.js'; describe('Integration | Repository | KnowledgeElementSnapshotRepository', function () { describe('#save', function () { diff --git a/api/tests/integration/infrastructure/repositories/knowledge-element-repository_test.js b/api/tests/shared/integration/infrastructure/repositories/knowledge-element-repository_test.js similarity index 99% rename from api/tests/integration/infrastructure/repositories/knowledge-element-repository_test.js rename to api/tests/shared/integration/infrastructure/repositories/knowledge-element-repository_test.js index 4dade014053..cadd18268f9 100644 --- a/api/tests/integration/infrastructure/repositories/knowledge-element-repository_test.js +++ b/api/tests/shared/integration/infrastructure/repositories/knowledge-element-repository_test.js @@ -1,9 +1,9 @@ import _ from 'lodash'; -import { DomainTransaction } from '../../../../lib/infrastructure/DomainTransaction.js'; -import * as knowledgeElementRepository from '../../../../lib/infrastructure/repositories/knowledge-element-repository.js'; -import { KnowledgeElement } from '../../../../src/shared/domain/models/KnowledgeElement.js'; -import { databaseBuilder, domainBuilder, expect, knex, sinon } from '../../../test-helper.js'; +import { DomainTransaction } from '../../../../../lib/infrastructure/DomainTransaction.js'; +import { KnowledgeElement } from '../../../../../src/shared/domain/models/KnowledgeElement.js'; +import * as knowledgeElementRepository from '../../../../../src/shared/infrastructure/repositories/knowledge-element-repository.js'; +import { databaseBuilder, domainBuilder, expect, knex, sinon } from '../../../../test-helper.js'; describe('Integration | Repository | knowledgeElementRepository', function () { describe('#batchSave', function () {