Aktueller Stand

This commit is contained in:
2026-01-16 23:02:36 +01:00
parent dcf45bac3d
commit b2b23268b2
14 changed files with 768 additions and 226 deletions

View File

@@ -1,6 +1,7 @@
import { NextResponse } from "next/server";
import { prisma } from "../../../../lib/prisma";
import { isAdminSession, requireSession } from "../../../../lib/auth-helpers";
import { getAccessSettings } from "../../../../lib/system-settings";
export async function PATCH(request: Request, context: { params: { id: string } }) {
const { session } = await requireSession();
@@ -23,7 +24,8 @@ export async function PATCH(request: Request, context: { params: { id: string }
locationLng,
startAt,
endAt,
categoryId
categoryId,
publicOverride
} = body || {};
if (status && ["APPROVED", "REJECTED"].includes(status)) {
@@ -44,6 +46,13 @@ export async function PATCH(request: Request, context: { params: { id: string }
const startDate = new Date(startAt);
const endDate = endAt ? new Date(endAt) : null;
const { publicAccessEnabled } = await getAccessSettings();
const overrideValue =
publicAccessEnabled && publicOverride !== undefined
? publicOverride === null || publicOverride === true || publicOverride === false
? publicOverride
: null
: undefined;
const event = await prisma.event.update({
where: { id: context.params.id },
@@ -56,7 +65,8 @@ export async function PATCH(request: Request, context: { params: { id: string }
locationLng: locationLng ? Number(locationLng) : null,
startAt: startDate,
endAt: endDate,
category: { connect: { id: categoryId } }
category: { connect: { id: categoryId } },
publicOverride: overrideValue
}
});