-
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.
Co-authored-by: Alexandre COIN <[email protected]> Co-authored-by: Andreia Pena <[email protected]>
- Loading branch information
1 parent
691a104
commit 1ee1841
Showing
14 changed files
with
359 additions
and
39 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { assertNotNullOrUndefined } from '../../../src/shared/domain/models/asserts.js'; | ||
|
||
export default class CertificationCancelled { | ||
/** | ||
* @param {Object} params | ||
* @param {number} params.certificationCourseId - certification course that will be rescored | ||
* @param {number} params.juryId - Id of the jury member who cancelled the certification | ||
*/ | ||
constructor({ certificationCourseId, juryId }) { | ||
assertNotNullOrUndefined(certificationCourseId); | ||
this.certificationCourseId = certificationCourseId; | ||
this.juryId = juryId; | ||
} | ||
} |
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
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
8 changes: 6 additions & 2 deletions
8
api/src/certification/session-management/application/cancellation-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
22 changes: 19 additions & 3 deletions
22
api/src/certification/session-management/domain/usecases/cancel-certification-course.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 |
---|---|---|
@@ -1,7 +1,23 @@ | ||
const cancelCertificationCourse = async function ({ certificationCourseId, certificationCourseRepository }) { | ||
/** | ||
* @typedef {import('./index.js'.CertificationCourseRepository} CertificationCourseRepository | ||
*/ | ||
|
||
import CertificationCancelled from '../../../../../lib/domain/events/CertificationCancelled.js'; | ||
|
||
/** | ||
* @param {Object} params | ||
* @param {number} params.certificationCourseId | ||
* @param {CertificationCourseRepository} params.certificationCourseRepository | ||
* @returns {Promise<CertificationCancelled>} | ||
*/ | ||
export const cancelCertificationCourse = async function ({ | ||
certificationCourseId, | ||
juryId, | ||
certificationCourseRepository, | ||
}) { | ||
const certificationCourse = await certificationCourseRepository.get({ id: certificationCourseId }); | ||
certificationCourse.cancel(); | ||
await certificationCourseRepository.update({ certificationCourse }); | ||
}; | ||
|
||
export { cancelCertificationCourse }; | ||
return new CertificationCancelled({ certificationCourseId: certificationCourse.getId(), juryId }); | ||
}; |
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
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.