feat: Added team page
Some checks failed
Build and Deploy / Deploy Web (push) Failing after 1s
Build and Deploy / Deploy Discord Bot (push) Failing after 1s

This commit is contained in:
2023-06-24 13:27:33 +02:00
parent 0588dd1c45
commit fbcd0d1bb9
11 changed files with 364 additions and 13 deletions

View File

@@ -0,0 +1,9 @@
export default defineEventHandler(async (event) => {
const userId: string = event.context.params ? event.context.params.id : '@me'
const user = await getUser(userId, event)
const { teamInvites } = await UserModel.findById(user._id).populate('teamInvites')
return teamInvites
})

View File

@@ -1,6 +1,8 @@
export default defineEventHandler(async (event) => {
const { teamId } = await readBody(event)
console.log(teamId)
const userId: string = event.context.params ? event.context.params.id : '@me'
if (userId === '@me') {
@@ -9,11 +11,11 @@ export default defineEventHandler(async (event) => {
const user = await getUser(userId, event)
const { teamInvites } = await UserModel.findByIdAndUpdate(user._id, {
await UserModel.findByIdAndUpdate(user._id, {
$addToSet: {
teamInvites: teamId
}
}) ?? { teamInvites: [] }
})
return teamInvites
return user
})