mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-11-09 21:51:29 +08:00
Consolidate personal bests endpoints (#2653)
This commit is contained in:
parent
3240abc22e
commit
f4bfb938b2
2 changed files with 7 additions and 13 deletions
|
|
@ -215,7 +215,7 @@ class UserController {
|
|||
req: MonkeyTypes.Request
|
||||
): Promise<MonkeyResponse> {
|
||||
const { uid } = req.ctx.decodedToken;
|
||||
const { mode, mode2 } = req.params;
|
||||
const { mode, mode2 } = req.query;
|
||||
|
||||
const data = (await UsersDAO.getPersonalBests(uid, mode, mode2)) ?? null;
|
||||
return new MonkeyResponse("Personal bests retrieved", data);
|
||||
|
|
|
|||
|
|
@ -202,24 +202,18 @@ router.post(
|
|||
);
|
||||
|
||||
router.get(
|
||||
"/personalBests/:mode/",
|
||||
"/personalBests",
|
||||
RateLimit.userGet,
|
||||
authenticateRequest({
|
||||
isPublic: false,
|
||||
acceptApeKeys: true,
|
||||
}),
|
||||
ApeRateLimit,
|
||||
asyncHandler(UserController.getPersonalBests)
|
||||
);
|
||||
|
||||
router.get(
|
||||
"/personalBests/:mode/:mode2",
|
||||
RateLimit.userGet,
|
||||
authenticateRequest({
|
||||
isPublic: false,
|
||||
acceptApeKeys: true,
|
||||
validateRequest({
|
||||
query: {
|
||||
mode: joi.string().required(),
|
||||
mode2: joi.string(),
|
||||
},
|
||||
}),
|
||||
ApeRateLimit,
|
||||
asyncHandler(UserController.getPersonalBests)
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue