prevent anonymous deletion of surveys

This commit is contained in:
Markus Brueckner 2025-01-13 21:33:24 +01:00
parent edb8c7b723
commit 97e84aaf09

View file

@ -4,7 +4,11 @@ import { surveysTable } from "../../../../db/schema";
import { eq } from "drizzle-orm";
export const DELETE: RequestHandler = async ({ params }) => {
export const DELETE: RequestHandler = async ({ params, locals }) => {
if (!locals.userId) {
return new Response(null, { status: 403 });
}
const surveyId = parseInt(params.surveyId ?? '');
if (isNaN(surveyId)) {