From 9fcd9882d7f53ea3093caba1935a6c6be010bc45 Mon Sep 17 00:00:00 2001 From: "Kalle (Sendou)" <38327916+Sendouc@users.noreply.github.com> Date: Fri, 19 Mar 2021 10:38:09 +0200 Subject: [PATCH] don't allow add votes api if voting is not active --- app/plus/service.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/plus/service.ts b/app/plus/service.ts index 34207b48d..f8169ae3b 100644 --- a/app/plus/service.ts +++ b/app/plus/service.ts @@ -403,6 +403,8 @@ const addVotes = async ({ input: z.infer; userId: number; }) => { + if (!getVotingRange().isHappening) + throw httpError.badRequest("voting is not happening right now"); const [plusStatuses, suggestions] = await Promise.all([ prisma.plusStatus.findMany({}), prisma.plusSuggestion.findMany({ where: { isResuggestion: false } }),