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 @@ -833,6 +833,12 @@ async function createChallenge (currentUser, challenge) {
833
833
}
834
834
challenge . name = xss ( challenge . name )
835
835
challenge . description = xss ( challenge . description )
836
+ if ( ! challenge . status ) {
837
+ challenge . status = constants . challengeStatuses . New
838
+ }
839
+ if ( ! challenge . startDate ) {
840
+ challenge . startDate = new Date ( )
841
+ }
836
842
if ( challenge . status === constants . challengeStatuses . Active ) {
837
843
throw new errors . BadRequestError ( 'You cannot create an Active challenge. Please create a Draft challenge and then change the status to Active.' )
838
844
}
@@ -1042,7 +1048,7 @@ createChallenge.schema = {
1042
1048
projectId : Joi . number ( ) . integer ( ) . positive ( ) . required ( ) ,
1043
1049
legacyId : Joi . number ( ) . integer ( ) . positive ( ) ,
1044
1050
startDate : Joi . date ( ) ,
1045
- status : Joi . string ( ) . valid ( _ . values ( constants . challengeStatuses ) ) . required ( ) ,
1051
+ status : Joi . string ( ) . valid ( _ . values ( constants . challengeStatuses ) ) ,
1046
1052
groups : Joi . array ( ) . items ( Joi . optionalId ( ) ) . unique ( ) ,
1047
1053
// gitRepoURLs: Joi.array().items(Joi.string().uri()),
1048
1054
terms : Joi . array ( ) . items ( Joi . object ( ) . keys ( {
You can’t perform that action at this time.
0 commit comments