Skip to content

Commit

Permalink
📅 add date validity checking to PUT /event
Browse files Browse the repository at this point in the history
  • Loading branch information
lachlanshoesmith committed Dec 13, 2024
1 parent c94b70b commit 9e98d4a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions backend/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,10 @@ app.put("/event", async (req: TypedRequest<UpdateEventBody>, res: Response) => {
return res.status(404).json({ message: "Event not found." });
}

if (!isValidDate(req.body.startDateTime, req.body.endDateTime)) {
return res.status(400).json({ message: "Invalid date" });
}

try {
const eventRes = await prisma.event.update({
where: {
Expand Down

0 comments on commit 9e98d4a

Please sign in to comment.