ghostguild-org/server/api/connections/pending-count.get.js
Jennie Robinson Faber dcb80e6006 feat: add connection API endpoints
Suggestions, create/confirm/hide/withdraw actions, my connections list,
and pending count for nav badge.
2026-04-05 16:48:10 +01:00

14 lines
361 B
JavaScript

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 }
})