mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
Mandatory pagination for GET /challenges/user (#12792)
* BREAKING: require pagination for GET /challenges/user * fix tests * remove unused test
This commit is contained in:
@@ -367,6 +367,11 @@ api.getUserChallenges = {
|
||||
url: '/challenges/user',
|
||||
middlewares: [authWithHeaders()],
|
||||
async handler (req, res) {
|
||||
req.checkQuery('page').notEmpty().isInt({ min: 0 }, apiError('queryPageInteger'));
|
||||
|
||||
const validationErrors = req.validationErrors();
|
||||
if (validationErrors) throw validationErrors;
|
||||
|
||||
const CHALLENGES_PER_PAGE = 10;
|
||||
const { page } = req.query;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user