-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🚚 chore(api): move student certification to
src
- Loading branch information
Showing
17 changed files
with
387 additions
and
382 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
api/src/certification/enrolment/application/certification-center-controller.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { usecases } from '../domain/usecases/index.js'; | ||
import * as studentCertificationSerializer from '../infrastructure/serializers/student-certification-serializer.js'; | ||
|
||
const getStudents = async function (request) { | ||
const certificationCenterId = request.params.certificationCenterId; | ||
const sessionId = request.params.sessionId; | ||
|
||
const { filter, page } = request.query; | ||
if (filter.divisions && !Array.isArray(filter.divisions)) { | ||
filter.divisions = [filter.divisions]; | ||
} | ||
|
||
const { data, pagination } = await usecases.findStudentsForEnrolment({ | ||
certificationCenterId, | ||
sessionId, | ||
page, | ||
filter, | ||
}); | ||
return studentCertificationSerializer.serialize(data, pagination); | ||
}; | ||
|
||
const certificationCenterController = { getStudents }; | ||
|
||
export { certificationCenterController }; |
46 changes: 46 additions & 0 deletions
46
api/src/certification/enrolment/application/session-students-route.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import Joi from 'joi'; | ||
|
||
import { securityPreHandlers } from '../../../shared/application/security-pre-handlers.js'; | ||
import { identifiersType } from '../../../shared/domain/types/identifiers-type.js'; | ||
import { certificationCenterController } from './certification-center-controller.js'; | ||
|
||
const register = async function (server) { | ||
server.route([ | ||
{ | ||
method: 'GET', | ||
path: '/api/certification-centers/{certificationCenterId}/sessions/{sessionId}/students', | ||
config: { | ||
validate: { | ||
params: Joi.object({ | ||
certificationCenterId: identifiersType.certificationCenterId, | ||
sessionId: identifiersType.sessionId, | ||
}), | ||
query: Joi.object({ | ||
filter: Joi.object({ | ||
divisions: Joi.array().items(Joi.string()), | ||
}).default({}), | ||
page: { | ||
number: Joi.number().integer(), | ||
size: Joi.number().integer(), | ||
}, | ||
}), | ||
}, | ||
pre: [ | ||
{ | ||
method: securityPreHandlers.checkUserIsMemberOfCertificationCenter, | ||
assign: 'isMemberOfCertificationCenter', | ||
}, | ||
], | ||
handler: certificationCenterController.getStudents, | ||
notes: [ | ||
'- **Cette route est restreinte aux utilisateurs authentifiés**\n' + | ||
"- Récupération d'une liste d'élèves SCO à partir d'un identifiant de centre de certification", | ||
], | ||
tags: ['api', 'certification-center', 'students', 'session'], | ||
}, | ||
}, | ||
]); | ||
}; | ||
|
||
const name = 'certification-centers-session-students-api'; | ||
export { name, register }; |
4 changes: 2 additions & 2 deletions
4
...n/usecases/find-students-for-enrolment.js → ...n/usecases/find-students-for-enrolment.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 7 additions & 7 deletions
14
...tories/organization-learner-repository.js → ...tories/organization-learner-repository.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.