// /opt/erp-system/app/api/time-entries/[id]/route.ts import { NextResponse } from 'next/server'; import prisma from '../../../../lib/prisma'; import { getServerSession } from "next-auth/next"; import { authOptions } from "../../auth/[...nextauth]/route"; export async function PUT( request: Request, context: { params: Promise<{ id: string }> } ) { const session = await getServerSession(authOptions); if (!session) return NextResponse.json({ error: 'Nicht autorisiert' }, { status: 401 }); try { const params = await context.params; const id = parseInt(params.id); const body = await request.json(); const updated = await prisma.timeEntry.update({ where: { id }, data: { description: body.description, durationMins: parseInt(body.durationMins) } }); return NextResponse.json(updated); } catch (error) { return NextResponse.json({ error: 'Fehler beim Update' }, { status: 500 }); } }