-
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.
[TECH] Utiliser la date de reconciliation dans le scoring (PIX-14540).
- Loading branch information
Showing
41 changed files
with
4,267 additions
and
4,524 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
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: 21 additions & 1 deletion
22
api/src/certification/evaluation/domain/models/Candidate.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,9 +1,29 @@ | ||
import Joi from 'joi'; | ||
|
||
import { EntityValidationError } from '../../../../shared/domain/errors.js'; | ||
|
||
export class Candidate { | ||
static #schema = Joi.object({ | ||
accessibilityAdjustmentNeeded: Joi.boolean().optional(), | ||
reconciledAt: Joi.date().required(), | ||
}); | ||
|
||
/** | ||
* @param {Object} params | ||
* @param {Date} params.reconciledAt | ||
* @param {boolean} [params.accessibilityAdjustmentNeeded] | ||
*/ | ||
constructor({ accessibilityAdjustmentNeeded } = {}) { | ||
constructor({ accessibilityAdjustmentNeeded, reconciledAt } = {}) { | ||
this.accessibilityAdjustmentNeeded = !!accessibilityAdjustmentNeeded; | ||
this.reconciledAt = reconciledAt; | ||
|
||
this.#validate(); | ||
} | ||
|
||
#validate() { | ||
const { error } = Candidate.#schema.validate(this, { allowUnknown: false }); | ||
if (error) { | ||
throw EntityValidationError.fromJoiErrors(error.details); | ||
} | ||
} | ||
} |
Oops, something went wrong.