Skip to content

Commit

Permalink
[TECH] Déplace l'ensemble des models et read-models restant dans …
Browse files Browse the repository at this point in the history
…`lib/` vers `src/shared/`

 #9697
  • Loading branch information
pix-service-auto-merge authored Jul 25, 2024
2 parents 9eee994 + f0a8df4 commit 56cc72f
Show file tree
Hide file tree
Showing 665 changed files with 1,258 additions and 918 deletions.
2 changes: 1 addition & 1 deletion api/db/database-builder/factory/build-badge-criterion.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SCOPES } from '../../../lib/domain/models/BadgeDetails.js';
import { SCOPES } from '../../../src/shared/domain/models/BadgeDetails.js';
import { databaseBuffer } from '../database-buffer.js';
import { buildBadge } from './build-badge.js';

Expand Down
2 changes: 1 addition & 1 deletion api/db/database-builder/factory/build-campaign.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import _ from 'lodash';

import { Assessment, CampaignTypes } from '../../../lib/domain/models/index.js';
import { Assessment, CampaignTypes } from '../../../src/shared/domain/models/index.js';
import { databaseBuffer } from '../database-buffer.js';
import { buildOrganization } from './build-organization.js';
import { buildTargetProfile } from './build-target-profile.js';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import _ from 'lodash';

import { Assessment } from '../../../lib/domain/models/index.js';
import { Assessment } from '../../../src/shared/domain/models/index.js';
import { databaseBuffer } from '../database-buffer.js';
import { buildAssessment } from './build-assessment.js';

Expand Down
2 changes: 1 addition & 1 deletion api/db/database-builder/factory/build-knowledge-element.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import _ from 'lodash';

import { KnowledgeElement } from '../../../lib/domain/models/KnowledgeElement.js';
import { KnowledgeElement } from '../../../src/shared/domain/models/KnowledgeElement.js';
import { databaseBuffer } from '../database-buffer.js';
import { buildAnswer } from './build-answer.js';
import { buildAssessment } from './build-assessment.js';
Expand Down
2 changes: 1 addition & 1 deletion api/db/database-builder/factory/build-membership.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import _ from 'lodash';

import { Membership } from '../../../lib/domain/models/Membership.js';
import { Membership } from '../../../src/shared/domain/models/Membership.js';
import { databaseBuffer } from '../database-buffer.js';
import { buildOrganization } from './build-organization.js';
import { buildUser } from './build-user.js';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PoleEmploiSending } from '../../../lib/domain/models/PoleEmploiSending.js';
import { PoleEmploiSending } from '../../../src/shared/domain/models/PoleEmploiSending.js';
import { databaseBuffer } from '../database-buffer.js';

const buildPoleEmploiSending = ({
Expand Down
2 changes: 1 addition & 1 deletion api/db/database-builder/factory/build-user.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import lodash from 'lodash';

const { isUndefined, isNil } = lodash;

import { AuthenticationMethod, Membership } from '../../../lib/domain/models/index.js';
import { PIX_ADMIN } from '../../../src/authorization/domain/constants.js';
import { NON_OIDC_IDENTITY_PROVIDERS } from '../../../src/identity-access-management/domain/constants/identity-providers.js';
import { AuthenticationMethod, Membership } from '../../../src/shared/domain/models/index.js';
import { cryptoService } from '../../../src/shared/domain/services/crypto-service.js';
import { databaseBuffer } from '../database-buffer.js';
import { buildCertificationCenter } from './build-certification-center.js';
Expand Down
2 changes: 1 addition & 1 deletion api/db/seeds/data/common/tooling/campaign-tooling.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import dayjs from 'dayjs';
import _ from 'lodash';

import { KnowledgeElement } from '../../../../../lib/domain/models/KnowledgeElement.js';
import { CampaignParticipationStatuses } from '../../../../../src/prescription/shared/domain/constants.js';
import { Assessment } from '../../../../../src/shared/domain/models/Assessment.js';
import { KnowledgeElement } from '../../../../../src/shared/domain/models/KnowledgeElement.js';
import { getPlacementProfile } from '../../../../../src/shared/domain/services/placement-profile-service.js';
import * as generic from './generic.js';
import * as learningContent from './learning-content.js';
Expand Down
2 changes: 1 addition & 1 deletion api/db/seeds/data/common/tooling/profile-tooling.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import _ from 'lodash';

import { PIX_COUNT_BY_LEVEL } from '../../../../../lib/domain/constants.js';
import { CompetenceEvaluation } from '../../../../../src/evaluation/domain/models/CompetenceEvaluation.js';
import { PIX_COUNT_BY_LEVEL } from '../../../../../src/shared/domain/constants.js';
import { Assessment } from '../../../../../src/shared/domain/models/Assessment.js';
import * as generic from './generic.js';
import * as learningContent from './learning-content.js';
Expand Down
2 changes: 1 addition & 1 deletion api/db/seeds/data/team-acces/build-sco-organizations.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Membership } from '../../../../lib/domain/models/Membership.js';
import { NON_OIDC_IDENTITY_PROVIDERS } from '../../../../src/identity-access-management/domain/constants/identity-providers.js';
import { Membership } from '../../../../src/shared/domain/models/Membership.js';
import { PIX_PUBLIC_TARGET_PROFILE_ID, REAL_PIX_SUPER_ADMIN_ID } from '../common/constants.js';
import { PIX_ORGA_ADMIN_LEAVING_ID, PIX_ORGA_ALL_ORGA_ID } from './build-organization-users.js';
import { ACCESS_SCO_BAUDELAIRE_EXTERNAL_ID, SCO_ORGANIZATION_ID } from './constants.js';
Expand Down
4 changes: 2 additions & 2 deletions api/db/seeds/data/team-certification/data-builder.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { CERTIFICATION_CENTER_MEMBERSHIP_ROLES } from '../../../../lib/domain/models/CertificationCenterMembership.js';
import { CertificationCenter } from '../../../../lib/domain/models/index.js';
import { Assessment } from '../../../../src/shared/domain/models/Assessment.js';
import { CERTIFICATION_CENTER_MEMBERSHIP_ROLES } from '../../../../src/shared/domain/models/CertificationCenterMembership.js';
import { CertificationCenter } from '../../../../src/shared/domain/models/index.js';
import {
CLEA_COMPLEMENTARY_CERTIFICATION_ID,
PIX_DROIT_COMPLEMENTARY_CERTIFICATION_ID,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Membership } from '../../domain/models/Membership.js';
import { Membership } from '../../../src/shared/domain/models/Membership.js';
import * as membershipRepository from '../../infrastructure/repositories/membership-repository.js';

const execute = async function (userId, organizationId, type) {
Expand Down
132 changes: 0 additions & 132 deletions api/lib/domain/constants.js

This file was deleted.

4 changes: 2 additions & 2 deletions api/lib/domain/events/handle-certification-rescoring.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { AssessmentResultFactory } from '../../../src/certification/scoring/domain/models/factories/AssessmentResultFactory.js';
import { CertificationVersion } from '../../../src/certification/shared/domain/models/CertificationVersion.js';
import { V3_REPRODUCIBILITY_RATE } from '../../../src/shared/domain/constants.js';
import { CertificationComputeError } from '../../../src/shared/domain/errors.js';
import { V3_REPRODUCIBILITY_RATE } from '../constants.js';
import { CertificationResult } from '../models/CertificationResult.js';
import { CertificationResult } from '../../../src/shared/domain/models/CertificationResult.js';
import { CertificationCourseRejected } from './CertificationCourseRejected.js';
import { CertificationCourseUnrejected } from './CertificationCourseUnrejected.js';
import { CertificationJuryDone } from './CertificationJuryDone.js';
Expand Down
4 changes: 2 additions & 2 deletions api/lib/domain/events/handle-certification-scoring.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { AssessmentResultFactory } from '../../../src/certification/scoring/domain/models/factories/AssessmentResultFactory.js';
import { CertificationVersion } from '../../../src/certification/shared/domain/models/CertificationVersion.js';
import { V3_REPRODUCIBILITY_RATE } from '../../../src/shared/domain/constants.js';
import { CertificationComputeError } from '../../../src/shared/domain/errors.js';
import { V3_REPRODUCIBILITY_RATE } from '../constants.js';
import { AssessmentResult } from '../models/index.js';
import { AssessmentResult } from '../../../src/shared/domain/models/index.js';
import { AssessmentCompleted } from './AssessmentCompleted.js';
import { CertificationScoringCompleted } from './CertificationScoringCompleted.js';
import { checkEventTypes } from './check-event-types.js';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { ComplementaryCertificationCourseResult } from '../../../src/certification/shared/domain/models/ComplementaryCertificationCourseResult.js';
import { config } from '../../../src/shared/config.js';
import { AnswerCollectionForScoring } from '../models/AnswerCollectionForScoring.js';
import { ComplementaryCertificationScoringWithComplementaryReferential } from '../models/ComplementaryCertificationScoringWithComplementaryReferential.js';
import { ComplementaryCertificationScoringWithoutComplementaryReferential } from '../models/ComplementaryCertificationScoringWithoutComplementaryReferential.js';
import { ReproducibilityRate } from '../models/ReproducibilityRate.js';
import { AnswerCollectionForScoring } from '../../../src/shared/domain/models/AnswerCollectionForScoring.js';
import { ComplementaryCertificationScoringWithComplementaryReferential } from '../../../src/shared/domain/models/ComplementaryCertificationScoringWithComplementaryReferential.js';
import { ComplementaryCertificationScoringWithoutComplementaryReferential } from '../../../src/shared/domain/models/ComplementaryCertificationScoringWithoutComplementaryReferential.js';
import { ReproducibilityRate } from '../../../src/shared/domain/models/ReproducibilityRate.js';
import { CertificationRescoringCompleted } from './CertificationRescoringCompleted.js';
import { CertificationScoringCompleted } from './CertificationScoringCompleted.js';
import { checkEventTypes } from './check-event-types.js';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { PoleEmploiSending } from '../../../src/shared/domain/models/PoleEmploiSending.js';
import { PoleEmploiPayload } from '../../infrastructure/externals/pole-emploi/PoleEmploiPayload.js';
import * as httpErrorsHelper from '../../infrastructure/http/errors-helper.js';
import { httpAgent } from '../../infrastructure/http/http-agent.js';
import * as monitoringTools from '../../infrastructure/monitoring-tools.js';
import { PoleEmploiSending } from '../models/PoleEmploiSending.js';
import { AssessmentCompleted } from './AssessmentCompleted.js';
import { checkEventTypes } from './check-event-types.js';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { PoleEmploiSending } from '../../../src/shared/domain/models/PoleEmploiSending.js';
import { PoleEmploiPayload } from '../../infrastructure/externals/pole-emploi/PoleEmploiPayload.js';
import * as httpErrorsHelper from '../../infrastructure/http/errors-helper.js';
import { httpAgent } from '../../infrastructure/http/http-agent.js';
import * as monitoringTools from '../../infrastructure/monitoring-tools.js';
import { PoleEmploiSending } from '../models/PoleEmploiSending.js';
import { CampaignParticipationStarted } from './CampaignParticipationStarted.js';
import { checkEventTypes } from './check-event-types.js';

Expand Down
2 changes: 0 additions & 2 deletions api/lib/domain/models/EmailingAttempt.js

This file was deleted.

14 changes: 7 additions & 7 deletions api/lib/domain/services/certification-challenges-service.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import _ from 'lodash';

import {
MAX_CHALLENGES_PER_AREA_FOR_CERTIFICATION_PLUS,
MAX_CHALLENGES_PER_COMPETENCE_FOR_CERTIFICATION,
PIX_ORIGIN,
} from '../../../src/shared/domain/constants.js';
import { CertificationChallenge } from '../../../src/shared/domain/models/CertificationChallenge.js';
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 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';
import {
MAX_CHALLENGES_PER_AREA_FOR_CERTIFICATION_PLUS,
MAX_CHALLENGES_PER_COMPETENCE_FOR_CERTIFICATION,
PIX_ORIGIN,
} from '../constants.js';
import { CertificationChallenge } from '../models/CertificationChallenge.js';
import { KnowledgeElement } from '../models/KnowledgeElement.js';

const pickCertificationChallenges = async function (
placementProfile,
Expand Down
2 changes: 1 addition & 1 deletion api/lib/domain/services/improvement-service.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import dayjs from 'dayjs';

import { constants } from '../constants.js';
import { constants } from '../../../src/shared/domain/constants.js';

function _keepKnowledgeElementsRecentOrValidated({ currentUserKnowledgeElements, assessment, minimumDelayInDays }) {
const startedDateOfAssessment = assessment.createdAt;
Expand Down
2 changes: 1 addition & 1 deletion api/lib/domain/services/services-utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ALL_TREATMENTS } from '../../../src/shared/domain/constants.js';
import { _ } from '../../../src/shared/infrastructure/utils/lodash-utils.js';
import { ALL_TREATMENTS } from '../constants.js';

function getEnabledTreatments(shouldApplyTreatments, deactivations) {
return shouldApplyTreatments ? ALL_TREATMENTS.filter((treatment) => !deactivations[treatment]) : [];
Expand Down
2 changes: 1 addition & 1 deletion api/lib/domain/services/tube-service.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import _ from 'lodash';

import { Tube } from '../models/Tube.js';
import { Tube } from '../../../src/shared/domain/models/Tube.js';

function computeTubesFromSkills(skills) {
const tubes = [];
Expand Down
3 changes: 1 addition & 2 deletions api/lib/domain/services/user-reconciliation-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ import fp from 'lodash/fp.js';
const { pipe } = fp;
import randomString from 'randomstring';

import { LEVENSHTEIN_DISTANCE_MAX_RATE } from '../../../src/shared/domain/constants.js';
import { LEVENSHTEIN_DISTANCE_MAX_RATE, STUDENT_RECONCILIATION_ERRORS } from '../../../src/shared/domain/constants.js';
import {
AlreadyRegisteredUsernameError,
NotFoundError,
OrganizationLearnerAlreadyLinkedToInvalidUserError,
OrganizationLearnerAlreadyLinkedToUserError,
} from '../../../src/shared/domain/errors.js';
import { areTwoStringsCloseEnough } from '../../../src/shared/domain/services/string-comparison-service.js';
import { STUDENT_RECONCILIATION_ERRORS } from '../constants.js';
import { isOneStringCloseEnoughFromMultipleStrings } from './string-comparison-service.js';
import { normalizeAndRemoveAccents, removeSpecialCharacters } from './validation-treatments.js';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import lodash from 'lodash';

import { CertificationsResults } from '../../read-models/livret-scolaire/CertificationsResults.js';
import { Competence } from '../../read-models/livret-scolaire/Competence.js';
import { CertificationsResults } from '../../../../src/shared/domain/read-models/livret-scolaire/CertificationsResults.js';
import { Competence } from '../../../../src/shared/domain/read-models/livret-scolaire/Competence.js';

const { sortBy } = lodash;

Expand Down
2 changes: 1 addition & 1 deletion api/lib/domain/usecases/check-sco-account-recovery.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { StudentInformationForAccountRecovery } from '../read-models/StudentInformationForAccountRecovery.js';
import { StudentInformationForAccountRecovery } from '../../../src/shared/domain/read-models/StudentInformationForAccountRecovery.js';

const checkScoAccountRecovery = async function ({
studentInformation,
Expand Down
2 changes: 1 addition & 1 deletion api/lib/domain/usecases/copy-target-profile.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TargetProfileForCreation } from '../models/index.js';
import { TargetProfileForCreation } from '../../../src/shared/domain/models/index.js';

const copyTargetProfile = async function ({ targetProfileId, targetProfileRepository }) {
const targetProfileToCopy = await targetProfileRepository.get(targetProfileId);
Expand Down
Loading

0 comments on commit 56cc72f

Please sign in to comment.