-
Notifications
You must be signed in to change notification settings - Fork 52
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
[FEATURE][BACK] Exposer les meta données pour la reconciliation des imports à format (PIX-13234) #9414
[FEATURE][BACK] Exposer les meta données pour la reconciliation des imports à format (PIX-13234) #9414
Conversation
Une fois les applications déployées, elles seront accessibles via les liens suivants :
Les variables d'environnement seront accessibles via les liens suivants : |
@@ -78,6 +80,10 @@ class CampaignToJoin { | |||
get isFlash() { | |||
return this.assessmentMethod === Assessment.methods.FLASH; | |||
} | |||
|
|||
#computeisRestrictedAccess(isManagingStudents, hasImportLearnerFeature) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion :
- soit renommer en
computeIsRestrictedAccess
- soit mettre l'ensemble en inline dans le constructor
- soit avoir un getter (option choisie ensemble)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
en fait le getter est pas possible car on recoit des param dans le constructeur qu'on ne stocke pas, j'ai préféré inliner le code du computeIsRestrictedAccess
dans le constructor
@@ -63,4 +63,50 @@ describe('Unit | Domain | Models | CampaignToJoin', function () { | |||
expect(campaignToJoin.isAccessible).to.be.true; | |||
}); | |||
}); | |||
|
|||
describe('#isRestrictedAccess', function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion : renommer le titre selon le nom de la propriété
@@ -1,5 +1,6 @@ | |||
import { knex } from '../../../../../db/knex-database-connection.js'; | |||
import { NotFoundError } from '../../../../../lib/domain/errors.js'; | |||
import * as organizationFeatureAPI from '../../../../organizational-entities/application/api/organization-features-api.js'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To do: injecter la dépendance au lieu de faire un import
@@ -50,6 +52,26 @@ describe('Integration | Repository | CampaignToJoin', function () { | |||
expect(actualCampaign.identityProvider).to.equal(OidcIdentityProviders.POLE_EMPLOI.code); | |||
}); | |||
|
|||
it('should return restricted access if organization has learner import feature', async function () { | |||
// given | |||
const organization = databaseBuilder.factory.buildOrganization({ isManagingStudents: false }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To do : une fois l'injection de dépendance faite, nous n'aurons pas besoin de "re-"tester cette partie là donc nous n'aurons pas besoin de recréer une organization ou une featureId
@@ -7,7 +7,7 @@ import { usecases } from '../../../../../src/prescription/campaign-participation | |||
import { ApplicationTransaction } from '../../../../../src/prescription/shared/infrastructure/ApplicationTransaction.js'; | |||
import { domainBuilder, expect, hFake, sinon } from '../../../../test-helper.js'; | |||
|
|||
describe('Unit | Application | Controller | Campaign-Participation', function () { | |||
describe('Unit | Application | Controller | learner-Participation', function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To do : mettre une majuscule à Learner
@@ -1,7 +1,7 @@ | |||
import { campaignParticipationController } from '../../../../lib/application/campaign-participations/campaign-participation-controller.js'; | |||
import { usecases as devcompUsecases } from '../../../../src/devcomp/domain/usecases/index.js'; | |||
import { expect, sinon } from '../../../test-helper.js'; | |||
describe('Unit | Application | Controller | Campaign-Participation', function () { | |||
describe('Unit | Application | Controller | Campaign-Participation (lib)', function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion : retirer (lib)
@@ -9,10 +9,12 @@ const save = async function (request, h, dependencies = { campaignParticipationS | |||
const userId = request.auth.credentials.userId; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion : drop ce commit car potentiellement on augmente la dette vis à vis de cette PR
@@ -3,6 +3,7 @@ | |||
*/ | |||
import { knex } from '../../../../db/knex-database-connection.js'; | |||
import * as knexUtils from '../../../../src/shared/infrastructure/utils/knex-utils.js'; | |||
import { ApplicationTransaction } from '../../../prescription/shared/infrastructure/ApplicationTransaction.js'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to do : drop ce commit aussi car utilise uniquement ce qui se trouve dans le commit précédent
this.multipleSendings = multipleSendings; | ||
this.assessmentMethod = assessmentMethod; | ||
this.skillCount = skillCount; | ||
this.organizationId = organizationId; | ||
this.deletedAt = deletedAt; | ||
this.#computeisRestrictedAccess(isManagingStudents, hasLearnersImportFeature); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to do :
- appliquer la même modification que pour
CampaignToJoin
- ajouter dans la dette technique : regarder la différence entre
CampaignToJoin
etCampaignToStartParticipation
- soit se baser sur le model
Campaign
pour les deux - soit les merger ensemble s'ils font la même chose
- soit se baser sur le model
@@ -226,13 +226,34 @@ describe('Unit | Domain | Models | CampaignParticipant', function () { | |||
let restrictedCampaign; | |||
beforeEach(function () { | |||
userIdentity = { id: 1 }; | |||
}); | |||
|
|||
it('throws a ForbiddenAccess exception when the user is not in the organization trainees on managingStudents cases', async function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To do : remplacer "trainees" par "learners"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion : déplacer ce fichier dans le commit où la gestion d'erreur est faite
@@ -8,12 +8,12 @@ import { | |||
import { OrganizationLearnerForStartingParticipation } from '../../../../../lib/domain/read-models/OrganizationLearnerForStartingParticipation.js'; | |||
import { UserIdentity } from '../../../../../lib/domain/read-models/UserIdentity.js'; | |||
import * as campaignRepository from '../../../../../lib/infrastructure/repositories/campaign-repository.js'; | |||
import * as organizationImportFeatureApi from '../../../../organizational-entities/application/api/organization-features-api.js'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To do : remplacer par l'injection de dépendance
this.#computeisRestrictedAccess(organizationIsManagingStudents, hasLearnersImportFeature); | ||
this.reconciliationFields = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion : remonter cette ligne une ligne plus haut
@@ -109,4 +109,46 @@ describe('Unit | Domain | Models | CampaignToJoin', function () { | |||
expect(campaignToJoin.isRestricted).to.be.false; | |||
}); | |||
}); | |||
|
|||
describe('#setReconciliationFields', function () { | |||
it('should return null when no reconcilation defined', function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion :
it('should return null when no reconciliation defined', function () {
}); | ||
|
||
describe('#isReconciliationRequired', function () { | ||
it('should return false when feature not enabled with reconcilationFields', function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion :
t('should return false when feature not enabled with reconciliationFields', function () {
b028f4c
to
5da82f8
Compare
5da82f8
to
61fd17c
Compare
…ature internal API
… campaignToStartParticipation model
61fd17c
to
14d15ba
Compare
🦄 Problème
Pour permettre aux apprenants d'une organization ayant l'import générique de se reconcilier, nous avons besoin de savoir quels champs permettent la réconciliation de cet apprenant
🤖 Proposition
Exposer les champs nécessaires à la réconciliation d'un apprenant par rapport à la config de l'import à format
🌈 Remarques
Le FRONT sera fait dans un second temps afin d'éviter une trop grosse PR
💯 Pour tester
CI au vert ( aller faire un test func sur la PR FRONT )