File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -846,6 +846,12 @@ async function createChallenge (currentUser, challenge) {
846
846
}
847
847
challenge . name = xss ( challenge . name )
848
848
challenge . description = xss ( challenge . description )
849
+ if ( ! challenge . status ) {
850
+ challenge . status = constants . challengeStatuses . New
851
+ }
852
+ if ( ! challenge . startDate ) {
853
+ challenge . startDate = new Date ( )
854
+ }
849
855
if ( challenge . status === constants . challengeStatuses . Active ) {
850
856
throw new errors . BadRequestError ( 'You cannot create an Active challenge. Please create a Draft challenge and then change the status to Active.' )
851
857
}
@@ -1055,7 +1061,7 @@ createChallenge.schema = {
1055
1061
projectId : Joi . number ( ) . integer ( ) . positive ( ) . required ( ) ,
1056
1062
legacyId : Joi . number ( ) . integer ( ) . positive ( ) ,
1057
1063
startDate : Joi . date ( ) ,
1058
- status : Joi . string ( ) . valid ( _ . values ( constants . challengeStatuses ) ) . required ( ) ,
1064
+ status : Joi . string ( ) . valid ( _ . values ( constants . challengeStatuses ) ) ,
1059
1065
groups : Joi . array ( ) . items ( Joi . optionalId ( ) ) . unique ( ) ,
1060
1066
// gitRepoURLs: Joi.array().items(Joi.string().uri()),
1061
1067
terms : Joi . array ( ) . items ( Joi . object ( ) . keys ( {
You can’t perform that action at this time.
0 commit comments