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:
parent
d69d21abd6
commit
dcb80e6006
7 changed files with 442 additions and 0 deletions
14
server/api/connections/pending-count.get.js
Normal file
14
server/api/connections/pending-count.get.js
Normal 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 }
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue