Files
Inna a73fe4d8d5 Foro: barra de acciones por publicación (me gusta, enlace, denuncia, marcador)
- 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>
2026-07-17 08:30:57 +00:00

18 lines
696 B
TypeScript

import { type NextRequest, NextResponse } from 'next/server'
import { getSession } from '@/lib/session'
import { togglePostLike } 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 togglePostLike(accountId, postId)
return NextResponse.json({ ok: true, ...r })
}