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) {
846846 }
847847 challenge . name = xss ( challenge . name )
848848 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+ }
849855 if ( challenge . status === constants . challengeStatuses . Active ) {
850856 throw new errors . BadRequestError ( 'You cannot create an Active challenge. Please create a Draft challenge and then change the status to Active.' )
851857 }
@@ -1055,7 +1061,7 @@ createChallenge.schema = {
10551061 projectId : Joi . number ( ) . integer ( ) . positive ( ) . required ( ) ,
10561062 legacyId : Joi . number ( ) . integer ( ) . positive ( ) ,
10571063 startDate : Joi . date ( ) ,
1058- status : Joi . string ( ) . valid ( _ . values ( constants . challengeStatuses ) ) . required ( ) ,
1064+ status : Joi . string ( ) . valid ( _ . values ( constants . challengeStatuses ) ) ,
10591065 groups : Joi . array ( ) . items ( Joi . optionalId ( ) ) . unique ( ) ,
10601066 // gitRepoURLs: Joi.array().items(Joi.string().uri()),
10611067 terms : Joi . array ( ) . items ( Joi . object ( ) . keys ( {
You can’t perform that action at this time.
0 commit comments