Skip to content

Commit

Permalink
feat: read parcoursup certification result from datamart
Browse files Browse the repository at this point in the history
  • Loading branch information
HEYGUL committed Dec 24, 2024
1 parent f3eef38 commit 7bb6409
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import { datamartKnex } from '../../../../db/knex-database-connection.js';
import { CertificationResult } from '../../domain/read-models/CertificationResult.js';

const get = ({ ine }) => {
return new CertificationResult({ ine });
const get = async ({ ine }) => {
const certificationResultDto = await datamartKnex('data_export_parcoursup_certif_result')
.where({ national_student_id: ine })
.limit(1)
.first();
return new CertificationResult({ ine: certificationResultDto.national_student_id });
};

export { get };
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import * as certificationRepository from '../../../../../api/src/parcoursup/infrastructure/repositories/certification-repository.js';
import { domainBuilder, expect } from '../../../test-helper.js';
import { datamartBuilder, domainBuilder, expect } from '../../../test-helper.js';

describe('Parcoursup | Infrastructure | Integration | Repositories | certification', function () {
describe('#get', function () {
describe('when a certification is found', function () {
it('should return the certification', async function () {
// given
const ine = '1234';
datamartBuilder.factory.buildCertificationResult({ nationalStudentId: ine });
await datamartBuilder.commit();

// when
const result = await certificationRepository.get({
ine,
});
const result = await certificationRepository.get({ ine });

// then
const expectedCertification = domainBuilder.parcoursup.buildCertificationResult({ ine });
Expand Down

0 comments on commit 7bb6409

Please sign in to comment.