a73fe4d8d5
- Me gusta con contador y toggle (al volver a pulsar se retira).
- Copiar enlace (permalink al post con ancla #post-ID).
- Denunciar: modal con motivos (troleo, amenaza, spam, etc.) + detalle.
- Guardar en marcadores + popover de recordatorio (2h/mañana/3 días/más)
y modal "Editar marcador" con nota y recordatorio (nota + remind_at en BD).
- Tablas acore_web: forum_post_like, forum_post_bookmark (+note,+remind_at), forum_post_report.
- APIs /api/forum/{like,bookmark,report,bookmark-reminder}, gated por sesión.
- Estilo oscuro+dorado de la web.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
18 lines
704 B
TypeScript
18 lines
704 B
TypeScript
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 })
|
|
}
|