// app/api/notifications/read-all/route.ts
import { auth } from "@/lib/auth"
import { NextResponse } from "next/server"
import { markAllAsRead } from "@/features/notifications/service"

export async function PATCH() {
  const session = await auth()
  if (!session?.user?.id) return NextResponse.json({ error: "Unauthorized" }, { status: 401 })

  const result = await markAllAsRead(session.user.id)
  return NextResponse.json({ ok: true, count: result.count })
}