import Connection from '../../models/connection.js'
import { requireAuth } from '../../utils/auth.js'

export default defineEventHandler(async (event) => {
  const member = await requireAuth(event)

  const count = await Connection.countDocuments({
    recipient: member._id,
    status: 'pending',
    hiddenBy: { $ne: member._id }
  })

  return { count }
})
