15 lines
358 B
TypeScript
15 lines
358 B
TypeScript
import { isAdmin, isLoggedIn } from "@server/middlewareButNotReally";
|
|
import { User } from "@models/user";
|
|
|
|
export default eventHandler(async (ev) => {
|
|
isLoggedIn(ev);
|
|
isAdmin(ev);
|
|
const b = await readBody(ev);
|
|
let idee = parseInt(getRouterParam(ev, "id")!);
|
|
await User.findByIdAndUpdate(idee, {
|
|
$set: {
|
|
"profile.isAdmin": b.promote,
|
|
},
|
|
});
|
|
});
|