feat: add connection API endpoints

Suggestions, create/confirm/hide/withdraw actions, my connections list,
and pending count for nav badge.
This commit is contained in:
Jennie Robinson Faber 2026-04-05 16:48:10 +01:00
parent d69d21abd6
commit dcb80e6006
7 changed files with 442 additions and 0 deletions

View file

@ -0,0 +1,14 @@
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 }
})