Polarcraft/webv2/server/api/teams/[id]/index.get.ts

11 lines
321 B
TypeScript
Raw Normal View History

2023-06-06 18:22:36 +02:00
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')
2023-06-01 22:06:11 +02:00
})