@@ -279,40 +279,43 @@ applicationRouter.route("/actions/choose-application-branch").post(
279279 }
280280
281281 if ( existingApplication ) {
282- const forbiddenStatuses = [ StatusType . APPLIED , StatusType . ACCEPTED , StatusType . CONFIRMED ] ;
283- if ( forbiddenStatuses . includes ( existingApplication . status ) ) {
284- throw new BadRequestError (
285- "You already have an active/pending application. Withdraw it first to submit a new one."
286- ) ;
287- }
288-
289- const updatedApplication = await ApplicationModel . accessibleBy ( req . ability )
290- . findOneAndUpdate (
291- {
292- userId : req . user ?. uid ,
293- hexathon : req . body . hexathon ,
294- } ,
295- {
296- status : StatusType . DRAFT ,
297- applicationBranch : req . body . applicationBranch ,
298- applicationStartTime : new Date ( ) ,
299- applicationSubmitTime : undefined ,
300- applicationExtendedDeadline : undefined ,
301- applicationData : { } ,
302- confirmationBranch : undefined ,
303- confirmationSubmitTime : undefined ,
304- confirmationExtendedDeadline : undefined ,
305- gradingComplete : false ,
306- name : getFullName ( userInfo . name ) ,
307- email : userInfo . email ,
308- } ,
309- {
310- new : true ,
311- }
312- )
313- . select ( "-finalScore" ) ;
314-
315- return res . send ( updatedApplication ) ;
282+ throw new BadRequestError (
283+ "You already have an active/pending application. Delete it first to submit a new one."
284+ ) ;
285+ // const forbiddenStatuses = [StatusType.APPLIED, StatusType.ACCEPTED, StatusType.CONFIRMED];
286+ // if (forbiddenStatuses.includes(existingApplication.status)) {
287+ // throw new BadRequestError(
288+ // "You already have an active/pending application. Delete it first to submit a new one."
289+ // );
290+ // }
291+
292+ // const updatedApplication = await ApplicationModel.accessibleBy(req.ability)
293+ // .findOneAndUpdate(
294+ // {
295+ // userId: req.user?.uid,
296+ // hexathon: req.body.hexathon,
297+ // },
298+ // {
299+ // status: StatusType.DRAFT,
300+ // applicationBranch: req.body.applicationBranch,
301+ // applicationStartTime: new Date(),
302+ // applicationSubmitTime: undefined,
303+ // applicationExtendedDeadline: undefined,
304+ // applicationData: {},
305+ // confirmationBranch: undefined,
306+ // confirmationSubmitTime: undefined,
307+ // confirmationExtendedDeadline: undefined,
308+ // gradingComplete: false,
309+ // name: getFullName(userInfo.name),
310+ // email: userInfo.email,
311+ // },
312+ // {
313+ // new: true,
314+ // }
315+ // )
316+ // .select("-finalScore");
317+
318+ // return res.send(updatedApplication);
316319 }
317320
318321 const newApplication = await ApplicationModel . create ( {
0 commit comments