|
1 | 1 | import { knex } from '../../../db/knex-database-connection.js';
|
2 | 2 | import { ORGANIZATION_FEATURE } from '../../../src/shared/domain/constants.js';
|
3 |
| -import { |
4 |
| - NotFoundError, |
5 |
| - OrganizationLearnerCertificabilityNotUpdatedError, |
6 |
| - OrganizationLearnerNotFound, |
7 |
| - UserNotFoundError, |
8 |
| -} from '../../../src/shared/domain/errors.js'; |
| 3 | +import { OrganizationLearnerNotFound, UserNotFoundError } from '../../../src/shared/domain/errors.js'; |
9 | 4 | import { OrganizationLearner } from '../../../src/shared/domain/models/OrganizationLearner.js';
|
10 | 5 | import { ParticipantRepartition } from '../../../src/shared/domain/models/ParticipantRepartition.js';
|
11 | 6 | import { fetchPage } from '../../../src/shared/infrastructure/utils/knex-utils.js';
|
@@ -93,19 +88,6 @@ function _queryBuilderDissociation(knexConn) {
|
93 | 88 | });
|
94 | 89 | }
|
95 | 90 |
|
96 |
| -const get = async function (organizationLearnerId) { |
97 |
| - const organizationLearner = await knex |
98 |
| - .select('*') |
99 |
| - .from('view-active-organization-learners') |
100 |
| - .where({ id: organizationLearnerId }) |
101 |
| - .first(); |
102 |
| - |
103 |
| - if (!organizationLearner) { |
104 |
| - throw new NotFoundError(`Student not found for ID ${organizationLearnerId}`); |
105 |
| - } |
106 |
| - return new OrganizationLearner(organizationLearner); |
107 |
| -}; |
108 |
| - |
109 | 91 | const getLatestOrganizationLearner = async function ({ nationalStudentId, birthdate }) {
|
110 | 92 | const organizationLearner = await knex
|
111 | 93 | .where({ nationalStudentId, birthdate })
|
@@ -148,18 +130,6 @@ const isActive = async function ({ userId, campaignId }) {
|
148 | 130 | return !learner?.isDisabled;
|
149 | 131 | };
|
150 | 132 |
|
151 |
| -async function updateCertificability(organizationLearner) { |
152 |
| - const result = await knex('organization-learners').where({ id: organizationLearner.id }).update({ |
153 |
| - isCertifiable: organizationLearner.isCertifiable, |
154 |
| - certifiableAt: organizationLearner.certifiableAt, |
155 |
| - }); |
156 |
| - if (result === 0) { |
157 |
| - throw new OrganizationLearnerCertificabilityNotUpdatedError( |
158 |
| - `Could not update certificability for OrganizationLearner with ID ${organizationLearner.id}.`, |
159 |
| - ); |
160 |
| - } |
161 |
| -} |
162 |
| - |
163 | 133 | async function countByOrganizationsWhichNeedToComputeCertificability({
|
164 | 134 | skipLoggedLastDayCheck = false,
|
165 | 135 | onlyNotComputed = false,
|
@@ -298,9 +268,7 @@ export {
|
298 | 268 | findByOrganizationIdAndUpdatedAtOrderByDivision,
|
299 | 269 | findByOrganizationsWhichNeedToComputeCertificability,
|
300 | 270 | findByUserId,
|
301 |
| - get, |
302 | 271 | getLatestOrganizationLearner,
|
303 | 272 | isActive,
|
304 |
| - updateCertificability, |
305 | 273 | updateUserIdWhereNull,
|
306 | 274 | };
|
0 commit comments