Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TECH] 🚚 deplace le learning-content-repository de lib ➡️ src (Pix-17008) #11661

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
144 changes: 0 additions & 144 deletions api/lib/infrastructure/repositories/learning-content-repository.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import _ from 'lodash';

import * as learningContentRepository from '../../../../../lib/infrastructure/repositories/learning-content-repository.js';
import * as learningContentRepository from '../../../../shared/infrastructure/repositories/learning-content-repository.js';
import {
MAX_CHALLENGES_PER_AREA_FOR_CERTIFICATION_PLUS,
MAX_CHALLENGES_PER_COMPETENCE_FOR_CERTIFICATION,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import _ from 'lodash';
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 { LearningContentDatasource } from '../../../shared/infrastructure/repositories/learning-content-datasource.js';
import * as skillRepository from '../../../shared/infrastructure/repositories/skill-repository.js';
import * as paginateModule from '../../../shared/infrastructure/utils/paginate.js';
import { Tutorial } from '../../domain/models/Tutorial.js';
Expand Down Expand Up @@ -161,12 +161,12 @@ export function clearCache(id) {
return getInstance().clearCache(id);
}

/** @type {LearningContentRepository} */
/** @type {LearningContentDatasource} */
let instance;

function getInstance() {
if (!instance) {
instance = new LearningContentRepository({ tableName: TABLE_NAME });
instance = new LearningContentDatasource({ tableName: TABLE_NAME });
}
return instance;
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';

import * as learningContentRepository from '../../../../../lib/infrastructure/repositories/learning-content-repository.js';
import * as learningContentRepository from '../../../../shared/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';
import * as compareStagesAndAcquiredStages from '../../../../evaluation/domain/services/stages/stage-and-stage-acquisition-comparison-service.js';
Expand Down Expand Up @@ -61,7 +61,7 @@ import * as poleEmploiSendingRepository from '../../infrastructure/repositories/
* @typedef { import ('../../../../evaluation/infrastructure/repositories/competence-evaluation-repository.js')} CompetenceEvaluationRepository
* @typedef { import ('../../../../shared/infrastructure/repositories/competence-repository.js')} CompetenceRepository
* @typedef { import ('../../../../../lib/infrastructure/repositories/knowledge-element-repository.js')} KnowledgeElementRepository
* @typedef { import ('../../../../../lib/infrastructure/repositories/learning-content-repository.js')} LearningContentRepository
* @typedef { import ('../../../../shared/infrastructure/repositories/learning-content-repository.js')} LearningContentRepository
* @typedef { import ('../../../../../lib/infrastructure/repositories/organization-learner-repository.js')} OrganizationLearnerRepository
* @typedef { import ('../../infrastructure/repositories/participant-result-repository.js')} ParticipantResultRepository
* @typedef { import ('../../infrastructure/repositories/participant-results-shared-repository.js')} participantResultsSharedRepository
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { knex } from '../../../../../db/knex-database-connection.js';
import * as learningContentRepository from '../../../../../lib/infrastructure/repositories/learning-content-repository.js';
import * as learningContentRepository from '../../../../shared/infrastructure/repositories/learning-content-repository.js';
import { NotFoundError } from '../../../../shared/domain/errors.js';
import * as knowledgeElementRepository from '../../../../shared/infrastructure/repositories/knowledge-element-repository.js';
import { CampaignAssessmentParticipationResult } from '../../domain/models/CampaignAssessmentParticipationResult.js';
Expand Down
4 changes: 2 additions & 2 deletions api/src/prescription/campaign/domain/usecases/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';

import * as learningContentRepository from '../../../../../lib/infrastructure/repositories/learning-content-repository.js';
import * as learningContentRepository from '../../../../shared/infrastructure/repositories/learning-content-repository.js';
import * as stageCollectionRepository from '../../../../../lib/infrastructure/repositories/user-campaign-results/stage-collection-repository.js';
import * as campaignRepository from '../../../../../src/prescription/campaign/infrastructure/repositories/campaign-repository.js';
import * as tutorialRepository from '../../../../devcomp/infrastructure/repositories/tutorial-repository.js';
Expand Down Expand Up @@ -45,7 +45,7 @@ import * as campaignUpdateValidator from '../validators/campaign-update-validato
* @typedef { import ('../../../../devcomp/infrastructure/repositories/tutorial-repository.js')} TutorialRepository
* @typedef { import ('../../../../../lib/infrastructure/repositories/knowledge-element-repository.js')} KnowledgeElementRepository
* @typedef { import ('../../../../../lib/infrastructure/repositories/knowledge-element-snapshot-repository.js')} KnowledgeElementSnapshotRepository
* @typedef { import ('../../../../../lib/infrastructure/repositories/learning-content-repository.js')} LearningContentRepository
* @typedef { import ('../../../../shared/infrastructure/repositories/learning-content-repository.js')} LearningContentRepository
* @typedef { import ('../../../../team/infrastructure/repositories/membership-repository.js')} MembershipRepository
* @typedef { import ('../../../../../lib/infrastructure/repositories/user-campaign-results/stage-collection-repository.js')} StageCollectionRepository
* @typedef { import ('../../../../evaluation/infrastructure/repositories/badge-repository.js')} BadgeRepository
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';

import * as learningContentConversionService from '../../../../../lib/domain/services/learning-content/learning-content-conversion-service.js';
import * as learningContentRepository from '../../../../../lib/infrastructure/repositories/learning-content-repository.js';
import * as learningContentRepository from '../../../../shared/infrastructure/repositories/learning-content-repository.js';
import { adminMemberRepository } from '../../../../shared/infrastructure/repositories/admin-member.repository.js';
import * as organizationRepository from '../../../../shared/infrastructure/repositories/organization-repository.js';
import { injectDependencies } from '../../../../shared/infrastructure/utils/dependency-injection.js';
Expand All @@ -18,7 +18,7 @@ import * as targetProfileSummaryForAdminRepository from '../../infrastructure/re
/**
* @typedef {import('../../infrastructure/repositories/')} AdminMemberRepository
* @typedef {import('../../../../../lib/domain/services/learning-content/learning-content-conversion-service.js')} LearningContentConversionService
* @typedef {import('../../../../../lib/infrastructure/repositories/learning-content-repository.js')} LearningContentRepository
* @typedef {import('../../../../shared/infrastructure/repositories/learning-content-repository.js')} LearningContentRepository
* @typedef {import('../../../../shared/infrastructure/repositories/organization-repository.js')} OrganizationRepository
* @typedef {import('../../infrastructure/repositories/organizations-to-attach-to-target-profile-repository.js')} OrganizationsToAttachToTargetProfileRepository
* @typedef {import('../../infrastructure/repositories/target-profile-administration-repository.js')} TargetProfileAdministrationRepository
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { config } from '../../../shared/config.js';
import { LOCALE } from '../../../shared/domain/constants.js';
import { getTranslatedKey } from '../../../shared/domain/services/get-translated-text.js';
import { LearningContentRepository } from '../../../shared/infrastructure/repositories/learning-content-repository.js';
import { LearningContentDatasource } from '../../../shared/infrastructure/repositories/learning-content-datasource.js';
import { Mission, MissionContent, MissionStep } from '../../domain/models/Mission.js';
import { MissionNotFoundError } from '../../domain/school-errors.js';

Expand Down Expand Up @@ -61,12 +61,12 @@ function toDomain(missionDto, locale) {
});
}

/** @type {LearningContentRepository} */
/** @type {LearningContentDatasource} */
let instance;

function getInstance() {
if (!instance) {
instance = new LearningContentRepository({ tableName: TABLE_NAME, idType: 'integer' });
instance = new LearningContentDatasource({ tableName: TABLE_NAME, idType: 'integer' });
}
return instance;
}
6 changes: 3 additions & 3 deletions api/src/shared/infrastructure/repositories/area-repository.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Area } from '../../domain/models/Area.js';
import { getTranslatedKey } from '../../domain/services/get-translated-text.js';
import { child, SCOPES } from '../utils/logger.js';
import * as competenceRepository from './competence-repository.js';
import { LearningContentRepository } from './learning-content-repository.js';
import { LearningContentDatasource } from './learning-content-datasource.js';

const TABLE_NAME = 'learningcontent.areas';

Expand Down Expand Up @@ -118,12 +118,12 @@ async function toDomainWithCompetences(areaDtos, locale) {
return areas;
}

/** @type {LearningContentRepository} */
/** @type {LearningContentDatasource} */
let instance;

function getInstance() {
if (!instance) {
instance = new LearningContentRepository({ tableName: TABLE_NAME });
instance = new LearningContentDatasource({ tableName: TABLE_NAME });
}
return instance;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Accessibility } from '../../domain/models/Challenge.js';
import { Challenge } from '../../domain/models/index.js';
import * as solutionAdapter from '../../infrastructure/adapters/solution-adapter.js';
import { child, SCOPES } from '../utils/logger.js';
import { LearningContentRepository } from './learning-content-repository.js';
import { LearningContentDatasource } from './learning-content-datasource.js';

const logger = child('learningcontent:repository', { event: SCOPES.LEARNING_CONTENT });

Expand Down Expand Up @@ -261,12 +261,12 @@ function toDomain({ challengeDto, webComponentTagName, webComponentProps, skill,
});
}

/** @type {LearningContentRepository} */
/** @type {LearningContentDatasource} */
let instance;

function getInstance() {
if (!instance) {
instance = new LearningContentRepository({ tableName: TABLE_NAME });
instance = new LearningContentDatasource({ tableName: TABLE_NAME });
}
return instance;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { NotFoundError } from '../../domain/errors.js';
import { Competence } from '../../domain/models/index.js';
import { getTranslatedKey } from '../../domain/services/get-translated-text.js';
import { child, SCOPES } from '../utils/logger.js';
import { LearningContentRepository } from './learning-content-repository.js';
import { LearningContentDatasource } from './learning-content-datasource.js';

const { FRENCH_FRANCE } = LOCALE;
const TABLE_NAME = 'learningcontent.competences';
Expand Down Expand Up @@ -77,12 +77,12 @@ function toDomain({ competenceDto, locale }) {
});
}

/** @type {LearningContentRepository} */
/** @type {LearningContentDatasource} */
let instance;

function getInstance() {
if (!instance) {
instance = new LearningContentRepository({ tableName: TABLE_NAME });
instance = new LearningContentDatasource({ tableName: TABLE_NAME });
}
return instance;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { NotFoundError } from '../../domain/errors.js';
import { Course } from '../../domain/models/Course.js';
import { LearningContentRepository } from './learning-content-repository.js';
import { LearningContentDatasource } from './learning-content-datasource.js';

const TABLE_NAME = 'learningcontent.courses';

Expand Down Expand Up @@ -36,12 +36,12 @@ function toDomain(courseDto) {
});
}

/** @type {LearningContentRepository} */
/** @type {LearningContentDatasource} */
let instance;

function getInstance() {
if (!instance) {
instance = new LearningContentRepository({ tableName: TABLE_NAME });
instance = new LearningContentDatasource({ tableName: TABLE_NAME });
}
return instance;
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { NotFoundError } from '../../domain/errors.js';
import { Framework } from '../../domain/models/index.js';
import { child, SCOPES } from '../utils/logger.js';
import { LearningContentRepository } from './learning-content-repository.js';
import { LearningContentDatasource } from './learning-content-datasource.js';

const TABLE_NAME = 'learningcontent.frameworks';

Expand Down Expand Up @@ -51,12 +51,12 @@ function byName(framework1, framework2) {
return collator.compare(framework1.name, framework2.name);
}

/** @type {LearningContentRepository} */
/** @type {LearningContentDatasource} */
let instance;

function getInstance() {
if (!instance) {
instance = new LearningContentRepository({ tableName: TABLE_NAME });
instance = new LearningContentDatasource({ tableName: TABLE_NAME });
}
return instance;
}
Loading