Polarcraft/webv2/server/api/teams/[id]/index.get.ts
Xeovalyte f9c13e5ada
All checks were successful
Build and Deploy / Deploy Web (push) Successful in 1m3s
Build and Deploy / Deploy Discord Bot (push) Successful in 43s
feat: Added team leave
2023-06-06 18:22:36 +02:00

11 lines
321 B
TypeScript

export default defineEventHandler(async (event) => {
let teamId: string = event.context.params ? event.context.params.id : '@current'
if (teamId === '@current') {
const user = await getUser('@me', event)
teamId = user.team._id.toString()
}
return await TeamModel.findById(teamId).populate('members')
})