Limit start pagination
This commit is contained in:
parent
0c141b121f
commit
a5095a2ca8
|
@ -121,6 +121,10 @@ const SORTABLE_COLUMNS = {
|
|||
PLAYLISTS_SEARCH: [ 'match', 'displayName', 'createdAt' ]
|
||||
}
|
||||
|
||||
const PAGINATION_START = {
|
||||
MAX: 9000
|
||||
}
|
||||
|
||||
const PAGINATION_COUNT = {
|
||||
DEFAULT: 20,
|
||||
MAX: 500
|
||||
|
@ -178,6 +182,7 @@ export {
|
|||
CONFIG,
|
||||
API_VERSION,
|
||||
PAGINATION_COUNT,
|
||||
PAGINATION_START,
|
||||
SORTABLE_COLUMNS,
|
||||
INDEXER_QUEUE_CONCURRENCY,
|
||||
SCHEDULER_INTERVALS_MS,
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import * as express from 'express'
|
||||
import { check } from 'express-validator'
|
||||
import { PAGINATION_COUNT } from '../../initializers/constants'
|
||||
import { PAGINATION_COUNT, PAGINATION_START } from '../../initializers/constants'
|
||||
import { areValidationErrors } from './utils'
|
||||
|
||||
const paginationValidator = [
|
||||
check('start')
|
||||
.optional()
|
||||
.isInt({ min: 0 }).withMessage('Should have a number start'),
|
||||
.isInt({ min: 0, max: PAGINATION_START.MAX }).withMessage(`Should have a number start (>= 0 and < ${PAGINATION_START.MAX}`),
|
||||
|
||||
check('count')
|
||||
.optional()
|
||||
|
|
Loading…
Reference in New Issue