Skip to content

Commit

Permalink
block already accepted applications
Browse files Browse the repository at this point in the history
  • Loading branch information
ramiAbdou committed Oct 8, 2024
1 parent 1242c2f commit 0e63c7d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/core/src/modules/application/application.core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,16 @@ async function shouldReject(
return [true, 'email_already_used'];
}

const applicationAcceptedWithSameEmail = await db
.selectFrom('applications')
.where('email', 'ilike', application.email)
.where('status', '=', ApplicationStatus.ACCEPTED)
.executeTakeFirst();

if (applicationAcceptedWithSameEmail) {
return [true, 'email_already_used'];
}

const postmark = getPostmarkInstance();

const bounces = await postmark.getBounces({
Expand Down

0 comments on commit 0e63c7d

Please sign in to comment.