Add typecheck

This commit is contained in:
2025-08-21 00:17:01 +02:00
parent 79c900955d
commit 5d1a029a54
12 changed files with 44 additions and 24 deletions
-1
View File
@@ -1,4 +1,3 @@
import { requireUserSession } from '#imports';
import { useValidatedBody, useValidatedParams, z, zh } from 'h3-zod';
import prisma from '~~/lib/prisma';
+3 -3
View File
@@ -76,11 +76,11 @@ export default defineEventHandler(async (event) => {
if (quest.hunt.teams.length <= 0) {
throw createError({ status: 403, statusText: 'No team yet!' });
}
if (quest.answers.length > 0 && quest.answers[0].final) {
if (quest.answers.length > 0 && quest.answers![0]?.final) {
throw createError({ status: 418, statusText: 'Already marked as final!' });
}
const team = quest.hunt.teams[0];
const team = quest.hunt.teams![0]!;
const body = await readFormData(event);
const formDataObj = Object.fromEntries(body.entries());
@@ -101,7 +101,7 @@ export default defineEventHandler(async (event) => {
const prevAnswer =
quest.answers.length > 0
? quest.answers[0]
? quest.answers![0]!
: {
updatedAt: null,
id: null