Skip to content

Commit

Permalink
fix: ensure correct hackathonId for application review (#67)
Browse files Browse the repository at this point in the history
Update getApplicationIdForReview to validate hackathonId for reviewing applications. This ensures that only applications from the current hackathon are fetched and processed correctly.
  • Loading branch information
MatejMa2ur authored Nov 10, 2024
1 parent f1e7b99 commit 4cdb0bb
Showing 1 changed file with 22 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,28 @@ const getApplicationIdForReview = async (
});

if (currentApplicationForReviewId) {
return {
totalApplicationsLeftToReviewCount: applications.length,
applicationId: currentApplicationForReviewId,
};
// Fetch the current application for review
const currentApplicationForReview = await prisma.application.findUnique({
where: {
id: currentApplicationForReviewId,
},
select: {
hacker: {
select: {
hackathonId: true,
},
},
},
});
if (
currentApplicationForReview &&
currentApplicationForReview.hacker.hackathonId === hackathonId
) {
return {
totalApplicationsLeftToReviewCount: applications.length,
applicationId: currentApplicationForReviewId,
};
}
}

if (applications.length === 0) {
Expand Down

0 comments on commit 4cdb0bb

Please sign in to comment.