import { ObjectId } from 'mongodb' export default defineEventHandler(async (event) => { const { userId } = await readBody(event) const user = await getAuth(event) if (!user.team.admin) return createError({ statusCode: 403, statusMessage: 'Admin team rol vereist' }) const usersColl = db.collection('users') await usersColl.findOneAndUpdate({ _id: new ObjectId(userId) }, { $set: { 'team.admin': false } }); return { status: 'Success' } });