mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-10-10 23:56:22 +08:00
admin validation
This commit is contained in:
parent
d881b642f9
commit
73a24af279
1 changed files with 7 additions and 0 deletions
|
@ -5,10 +5,12 @@ import {
|
|||
asyncHandler,
|
||||
checkIfUserIsAdmin,
|
||||
validateConfiguration,
|
||||
validateRequest,
|
||||
} from "../../middlewares/api-utils";
|
||||
import * as AdminController from "../controllers/admin";
|
||||
import { adminLimit } from "../../middlewares/rate-limit";
|
||||
import { toggleBan } from "../controllers/user";
|
||||
import joi from "joi";
|
||||
|
||||
const router = Router();
|
||||
|
||||
|
@ -38,6 +40,11 @@ router.post(
|
|||
noCache: true,
|
||||
}),
|
||||
checkIfUserIsAdmin(),
|
||||
validateRequest({
|
||||
body: {
|
||||
uid: joi.string().required().token(),
|
||||
},
|
||||
}),
|
||||
asyncHandler(toggleBan)
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue