-
Notifications
You must be signed in to change notification settings - Fork 58
/
Copy pathindex.js
131 lines (124 loc) · 9.45 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
import * as obfuscationService from '../../../../../lib/domain/services/obfuscation-service.js';
import * as userReconciliationService from '../../../../../lib/domain/services/user-reconciliation-service.js';
import * as campaignRepository from '../../../../../lib/infrastructure/repositories/campaign-repository.js';
import * as libOrganizationLearnerRepository from '../../../../../lib/infrastructure/repositories/organization-learner-repository.js';
import * as userRepository from '../../../../identity-access-management/infrastructure/repositories/user.repository.js';
import * as organizationFeatureApi from '../../../../organizational-entities/application/api/organization-features-api.js';
import * as placementProfileService from '../../../../shared/domain/services/placement-profile-service.js';
import { logErrorWithCorrelationIds } from '../../../../shared/infrastructure/monitoring-tools.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';
import { logger } from '../../../../shared/infrastructure/utils/logger.js';
import * as membershipRepository from '../../../../team/infrastructure/repositories/membership.repository.js';
import * as registrationOrganizationLearnerRepository from '../../../organization-learner/infrastructure/repositories/registration-organization-learner-repository.js';
import * as campaignParticipationRepository from '../../infrastructure/repositories/campaign-participation-repository.js';
import { repositories } from '../../infrastructure/repositories/index.js';
import { importOrganizationLearnersJobRepository } from '../../infrastructure/repositories/jobs/import-organization-learners-job-repository.js';
import { importScoCsvOrganizationLearnersJobRepository } from '../../infrastructure/repositories/jobs/import-sco-csv-organization-learners-job-repository.js';
import { importSupOrganizationLearnersJobRepository } from '../../infrastructure/repositories/jobs/import-sup-organization-learners-job-repository.js';
import { validateCsvOrganizationImportFileJobRepository } from '../../infrastructure/repositories/jobs/validate-csv-organization-learners-import-file-job-repository.js';
import { validateOrganizationImportFileJobRepository } from '../../infrastructure/repositories/jobs/validate-organization-learners-import-file-job-repository.js';
import * as organizationImportRepository from '../../infrastructure/repositories/organization-import-repository.js';
import * as organizationLearnerImportFormatRepository from '../../infrastructure/repositories/organization-learner-import-format-repository.js';
import * as organizationLearnerRepository from '../../infrastructure/repositories/organization-learner-repository.js';
import * as studentRepository from '../../infrastructure/repositories/student-repository.js';
import * as supOrganizationLearnerRepository from '../../infrastructure/repositories/sup-organization-learner-repository.js';
import { importStorage } from '../../infrastructure/storage/import-storage.js';
/**
* @typedef {import ('../../infrastructure/repositories/organization-feature-repository.js')} CampaignParticipationRepository
* @typedef {import ('../../../../../lib/infrastructure/repositories/campaign-repository.js')} CampaignRepository
* @typedef {import ('../../infrastructure/repositories/jobs/import-organization-learners-job-repository.js')} ImportOrganizationLearnersJobRepository
* @typedef {import ('../../infrastructure/storage/import-storage.js')} ImportStorage
* @typedef {import ('../../infrastructure/repositories/jobs/import-sup-organization-learners-job-repository.js')} ImportSupOrganizationLearnersJobRepository
* @typedef {import ('../../infrastructure/repositories/jobs/import-sco-csv-organization-learners-job-repository.js')} importScoCsvOrganizationLearnersJobRepository
* @typedef {import ('../../../../../lib/infrastructure/repositories/organization-learner-repository.js')} libOrganizationLearnerRepository
* @typedef {import ('../../../../shared/infrastructure/monitoring-tools.js')} LogErrorWithCorrelationIds
* @typedef {import ('../../../../shared/infrastructure/utils/logger.js')} loggger
* @typedef {import ('../../../../team/infrastructure/repositories/membership-repository.js')} MembershipRepository
* @typedef {import ('../../../../../lib/domain/services/obfuscation-service.js')} obfuscationService
* @typedef {import ('../../../../organizational-entities/application/api/organization-features-api.js')} OrganizationFeatureApi
* @typedef {import ('../../infrastructure/repositories/organization-feature-repository.js')} OrganizationFeatureRepository
* @typedef {import ('../../infrastructure/repositories/organization-import-repository.js')} OrganizationImportRepository
* @typedef {import ('../../infrastructure/repositories/organization-learner-import-format-repository.js')} OrganizationLearnerImportFormatRepository
* @typedef {import ('../../infrastructure/repositories/organization-learner-repository.js')} OrganizationLearnerRepository
* @typedef {import ('../../../../shared/infrastructure/repositories/organization-repository.js')} OrganizationRepository
* @typedef {import ('../../../../shared/domain/services/placement-profile-service.js')} placementProfileService
* @typedef {import('../../../organization-learner/infrastructure/repositories/registration-organization-learner-repository.js')} registrationOrganizationLearnerRepository
* @typedef {import ('../../infrastructure/repositories/student-repository.js')} studentRepository
* @typedef {import ('../../infrastructure/repositories/sup-organization-learner-repository.js')} SupOrganizationLearnerRepository
* @typedef {import ('../../../../../lib/domain/services/user-reconciliation-service.js')} UserReconciliationService
* @typedef {import('../../../../identity-access-management/infrastructure/repositories/user.repository.js')} userRepository
* @typedef {import('../../infrastructure/repositories/jobs/validate-csv-organization-learners-import-file-job-repository.js')} validateCsvOrganizationImportFileJobRepository
* @typedef {import ('../../infrastructure/repositories/jobs/validate-organization-learners-import-file-job-repository.js')} ValidateOrganizationImportFileJobRepository
*/
const dependencies = {
campaignParticipationRepository,
campaignRepository,
importOrganizationLearnersJobRepository,
importScoCsvOrganizationLearnersJobRepository,
importStorage,
importSupOrganizationLearnersJobRepository,
libOrganizationLearnerRepository,
logErrorWithCorrelationIds,
logger,
membershipRepository,
obfuscationService,
organizationFeatureApi,
organizationFeatureRepository: repositories.organizationFeatureRepository,
organizationImportRepository,
organizationLearnerImportFormatRepository,
organizationLearnerRepository,
organizationRepository,
placementProfileService,
registrationOrganizationLearnerRepository,
studentRepository,
supOrganizationLearnerRepository,
userReconciliationService,
userRepository,
validateCsvOrganizationImportFileJobRepository,
validateOrganizationImportFileJobRepository,
};
const path = dirname(fileURLToPath(import.meta.url));
const usecasesWithoutInjectedDependencies = {
...(await importNamedExportsFromDirectory({
path: join(path, './'),
ignoredFileNames: ['index.js'],
})),
...(await importNamedExportsFromDirectory({
path: join(path, './import-from-feature/'),
ignoredFileNames: ['index.js'],
})),
};
/**
* @typedef PrescriptionLearnerManagementUsecases
* @property {computeOrganizationLearnerCertificability} computeOrganizationLearnerCertificability
* @property {saveOrganizationLearnersFile} saveOrganizationLearnersFile
* @property {sendOrganizationLearnersFile} sendOrganizationLearnersFile
* @property {validateOrganizationLearnersFile} validateOrganizationLearnersFile
* @property {addOrUpdateOrganizationLearners} addOrUpdateOrganizationLearners
* @property {deleteOrganizationLearners} deleteOrganizationLearners
* @property {dissociateUserFromOrganizationLearner} dissociateUserFromOrganizationLearner
* @property {getOrganizationImportStatus} getOrganizationImportStatus
* @property {getOrganizationLearnersCsvTemplate} getOrganizationLearnersCsvTemplate
* @property {handlePayloadTooLargeError} handlePayloadTooLargeError
* @property {importOrganizationLearnersFromSIECLECSVFormat} importOrganizationLearnersFromSIECLECSVFormat
* @property {importSupOrganizationLearners} importSupOrganizationLearners
* @property {hasBeenLearner} hasBeenLearner
* @property {reconcileCommonOrganizationLearner} reconcileCommonOrganizationLearner
* @property {reconcileScoOrganizationLearnerAutomatically} reconcileScoOrganizationLearnerAutomatically
* @property {replaceSupOrganizationLearners} replaceSupOrganizationLearners
* @property {updateOrganizationLearnerImportFormats} updateOrganizationLearnerImportFormats
* @property {updateStudentNumber} updateStudentNumber
* @property {uploadCsvFile} uploadCsvFile
* @property {uploadSiecleFile} uploadSiecleFile
* @property {validateCsvFile} validateCsvFile
* @property {validateSiecleXmlFile} validateSiecleXmlFile
*/
/**
* @type {PrescriptionLearnerManagementUsecases}
*/
const usecases = injectDependencies(usecasesWithoutInjectedDependencies, dependencies);
export { usecases };