]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/middlewares/validators/sort.ts
Use sequelize scopes
[github/Chocobozzz/PeerTube.git] / server / middlewares / validators / sort.ts
index 636f68885ab106d6b47550fdf734ce307e5d1f87..38184fefa0dc6e6a0a98fd38c0c375aa6a70eb08 100644 (file)
@@ -1,12 +1,12 @@
 import { query } from 'express-validator/check'
 import * as express from 'express'
-
 import { logger } from '../../helpers'
 import { SORTABLE_COLUMNS } from '../../initializers'
 import { areValidationErrors } from './utils'
 
 // Initialize constants here for better performances
 const SORTABLE_USERS_COLUMNS = createSortableColumns(SORTABLE_COLUMNS.USERS)
+const SORTABLE_JOBS_COLUMNS = createSortableColumns(SORTABLE_COLUMNS.JOBS)
 const SORTABLE_VIDEO_ABUSES_COLUMNS = createSortableColumns(SORTABLE_COLUMNS.VIDEO_ABUSES)
 const SORTABLE_VIDEOS_COLUMNS = createSortableColumns(SORTABLE_COLUMNS.VIDEOS)
 const SORTABLE_BLACKLISTS_COLUMNS = createSortableColumns(SORTABLE_COLUMNS.BLACKLISTS)
@@ -15,6 +15,7 @@ const SORTABLE_FOLLOWERS_COLUMNS = createSortableColumns(SORTABLE_COLUMNS.FOLLOW
 const SORTABLE_FOLLOWING_COLUMNS = createSortableColumns(SORTABLE_COLUMNS.FOLLOWING)
 
 const usersSortValidator = checkSort(SORTABLE_USERS_COLUMNS)
+const jobsSortValidator = checkSort(SORTABLE_JOBS_COLUMNS)
 const videoAbusesSortValidator = checkSort(SORTABLE_VIDEO_ABUSES_COLUMNS)
 const videosSortValidator = checkSort(SORTABLE_VIDEOS_COLUMNS)
 const blacklistSortValidator = checkSort(SORTABLE_BLACKLISTS_COLUMNS)
@@ -31,7 +32,8 @@ export {
   videosSortValidator,
   blacklistSortValidator,
   followersSortValidator,
-  followingSortValidator
+  followingSortValidator,
+  jobsSortValidator
 }
 
 // ---------------------------------------------------------------------------