Suggestions, create/confirm/hide/withdraw actions, my connections list, and pending count for nav badge.
14 lines
361 B
JavaScript
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 }
|
|
})
|