Skip to content

Commit 9051da0

Browse files
committed
added specific case handling for rejected participants to apply as volunteers
1 parent ed2d810 commit 9051da0

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

services/registration/src/routes/application.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,15 @@ applicationRouter.route("/actions/choose-application-branch").post(
282282
}
283283

284284
if (existingApplication) {
285-
throw new BadRequestError(
286-
"You already have an active/pending application. Delete it first to submit a new one."
287-
);
285+
const isRejectedParticipant =
286+
existingApplication.applicationBranch.applicationGroup ===
287+
ApplicationGroupType.PARTICIPANT && existingApplication.status === StatusType.DENIED;
288+
// Allows rejected applicants to apply as volunteer even though they already have an active application
289+
if (!isRejectedParticipant || req.body.applicationBranch !== ApplicationGroupType.VOLUNTEER) {
290+
throw new BadRequestError(
291+
"You already have an active/pending application. Delete it first to submit a new one."
292+
);
293+
}
288294
// const forbiddenStatuses = [StatusType.APPLIED, StatusType.ACCEPTED, StatusType.CONFIRMED];
289295
// if (forbiddenStatuses.includes(existingApplication.status)) {
290296
// throw new BadRequestError(
@@ -575,7 +581,8 @@ applicationRouter.route("/:id/actions/update-status").post(
575581
) {
576582
updateBody.confirmationSubmitTime = new Date();
577583
} else if (
578-
(existingApplication.status === StatusType.ACCEPTED || existingApplication.status === StatusType.CONFIRMED) &&
584+
(existingApplication.status === StatusType.ACCEPTED ||
585+
existingApplication.status === StatusType.CONFIRMED) &&
579586
newStatus === StatusType.NOT_ATTENDING
580587
) {
581588
// pass

0 commit comments

Comments
 (0)