File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ const addProjectPhaseValidations = {
1414 param : Joi . object ( ) . keys ( {
1515 name : Joi . string ( ) . required ( ) ,
1616 status : Joi . string ( ) . required ( ) ,
17- startDate : Joi . date ( ) . max ( Joi . ref ( 'endDate' ) ) . optional ( ) ,
17+ startDate : Joi . date ( ) . optional ( ) ,
1818 endDate : Joi . date ( ) . optional ( ) ,
1919 duration : Joi . number ( ) . min ( 0 ) . optional ( ) ,
2020 budget : Joi . number ( ) . min ( 0 ) . optional ( ) ,
@@ -52,6 +52,11 @@ module.exports = [
5252 err . status = 404 ;
5353 throw err ;
5454 }
55+ if ( data . startDate !== null && data . endDate !== null && data . startDate > data . endDate ) {
56+ const err = new Error ( 'startDate must not be after endDate.' ) ;
57+ err . status = 400 ;
58+ throw err ;
59+ }
5560 return models . ProjectPhase
5661 . create ( data )
5762 . then ( ( _newProjectPhase ) => {
You can’t perform that action at this time.
0 commit comments