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) {
833833 }
834834 challenge . name = xss ( challenge . name )
835835 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+ }
836842 if ( challenge . status === constants . challengeStatuses . Active ) {
837843 throw new errors . BadRequestError ( 'You cannot create an Active challenge. Please create a Draft challenge and then change the status to Active.' )
838844 }
@@ -1042,7 +1048,7 @@ createChallenge.schema = {
10421048 projectId : Joi . number ( ) . integer ( ) . positive ( ) . required ( ) ,
10431049 legacyId : Joi . number ( ) . integer ( ) . positive ( ) ,
10441050 startDate : Joi . date ( ) ,
1045- status : Joi . string ( ) . valid ( _ . values ( constants . challengeStatuses ) ) . required ( ) ,
1051+ status : Joi . string ( ) . valid ( _ . values ( constants . challengeStatuses ) ) ,
10461052 groups : Joi . array ( ) . items ( Joi . optionalId ( ) ) . unique ( ) ,
10471053 // gitRepoURLs: Joi.array().items(Joi.string().uri()),
10481054 terms : Joi . array ( ) . items ( Joi . object ( ) . keys ( {
You can’t perform that action at this time.
0 commit comments