import { type NextRequest, NextResponse } from 'next/server' import { getSession } from '@/lib/session' import { togglePostBookmark } from '@/lib/forum-social' export const runtime = 'nodejs' export const dynamic = 'force-dynamic' export async function POST(req: NextRequest) { const session = await getSession() const accountId = session.accountId ?? 0 if (!accountId) return NextResponse.json({ ok: false }, { status: 401 }) let postId = 0 try { postId = Number((await req.json())?.postId) || 0 } catch { /* */ } if (!postId) return NextResponse.json({ ok: false }, { status: 400 }) const r = await togglePostBookmark(accountId, postId) return NextResponse.json({ ok: true, ...r }) }