don't allow add votes api if voting is not active

This commit is contained in:
Kalle (Sendou)
2021-03-19 10:38:09 +02:00
parent bd7a9252c6
commit 9fcd9882d7

View File

@@ -403,6 +403,8 @@ const addVotes = async ({
input: z.infer<typeof votesSchema>;
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 } }),