mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 10:49:28 +02:00
Add outbox page size parameter
This commit is contained in:
parent
c08579e14f
commit
fbc77eb648
4 changed files with 36 additions and 4 deletions
|
@ -1,2 +1,3 @@
|
|||
export * from './activity'
|
||||
export * from './signature'
|
||||
export * from './pagination'
|
||||
|
|
23
server/middlewares/validators/activitypub/pagination.ts
Normal file
23
server/middlewares/validators/activitypub/pagination.ts
Normal file
|
@ -0,0 +1,23 @@
|
|||
import * as express from 'express'
|
||||
import { query } from 'express-validator'
|
||||
import { logger } from '../../../helpers/logger'
|
||||
import { areValidationErrors } from '../utils'
|
||||
|
||||
const apPaginationValidator = [
|
||||
query('page').optional().isInt({ min: 1 }).withMessage('Should have a valid page number'),
|
||||
query('size').optional().isInt({ max: 50 }).withMessage('Should have a valid page size (max: 50)'),
|
||||
|
||||
(req: express.Request, res: express.Response, next: express.NextFunction) => {
|
||||
logger.debug('Checking pagination parameters', { parameters: req.query })
|
||||
|
||||
if (areValidationErrors(req, res)) return
|
||||
|
||||
return next()
|
||||
}
|
||||
]
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export {
|
||||
apPaginationValidator
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue