]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/middlewares/validators/sort.ts
Merge branch 'move-utils-to-shared' of https://github.com/buoyantair/PeerTube into...
[github/Chocobozzz/PeerTube.git] / server / middlewares / validators / sort.ts
CommitLineData
65fcc311 1import { SORTABLE_COLUMNS } from '../../initializers'
5c328e66 2import { checkSort, createSortableColumns } from './utils'
a877d5ac 3
9c2c18f3 4// Initialize constants here for better performances
65fcc311 5const SORTABLE_USERS_COLUMNS = createSortableColumns(SORTABLE_COLUMNS.USERS)
265ba139 6const SORTABLE_ACCOUNTS_COLUMNS = createSortableColumns(SORTABLE_COLUMNS.ACCOUNTS)
5cd80545 7const SORTABLE_JOBS_COLUMNS = createSortableColumns(SORTABLE_COLUMNS.JOBS)
65fcc311
C
8const SORTABLE_VIDEO_ABUSES_COLUMNS = createSortableColumns(SORTABLE_COLUMNS.VIDEO_ABUSES)
9const SORTABLE_VIDEOS_COLUMNS = createSortableColumns(SORTABLE_COLUMNS.VIDEOS)
57c36b27 10const SORTABLE_VIDEOS_SEARCH_COLUMNS = createSortableColumns(SORTABLE_COLUMNS.VIDEOS_SEARCH)
f37dc0dd 11const SORTABLE_VIDEO_CHANNELS_SEARCH_COLUMNS = createSortableColumns(SORTABLE_COLUMNS.VIDEO_CHANNELS_SEARCH)
ed31c059 12const SORTABLE_VIDEO_IMPORTS_COLUMNS = createSortableColumns(SORTABLE_COLUMNS.VIDEO_IMPORTS)
bf1f6508 13const SORTABLE_VIDEO_COMMENT_THREADS_COLUMNS = createSortableColumns(SORTABLE_COLUMNS.VIDEO_COMMENT_THREADS)
792dbaf0 14const SORTABLE_BLACKLISTS_COLUMNS = createSortableColumns(SORTABLE_COLUMNS.BLACKLISTS)
72c7248b 15const SORTABLE_VIDEO_CHANNELS_COLUMNS = createSortableColumns(SORTABLE_COLUMNS.VIDEO_CHANNELS)
7a7724e6
C
16const SORTABLE_FOLLOWERS_COLUMNS = createSortableColumns(SORTABLE_COLUMNS.FOLLOWERS)
17const SORTABLE_FOLLOWING_COLUMNS = createSortableColumns(SORTABLE_COLUMNS.FOLLOWING)
06a05d5f 18const SORTABLE_USER_SUBSCRIPTIONS_COLUMNS = createSortableColumns(SORTABLE_COLUMNS.USER_SUBSCRIPTIONS)
7ad9b984
C
19const SORTABLE_ACCOUNTS_BLOCKLIST_COLUMNS = createSortableColumns(SORTABLE_COLUMNS.ACCOUNTS_BLOCKLIST)
20const SORTABLE_SERVERS_BLOCKLIST_COLUMNS = createSortableColumns(SORTABLE_COLUMNS.SERVERS_BLOCKLIST)
5c39adb7 21
b60e5f38 22const usersSortValidator = checkSort(SORTABLE_USERS_COLUMNS)
265ba139 23const accountsSortValidator = checkSort(SORTABLE_ACCOUNTS_COLUMNS)
5cd80545 24const jobsSortValidator = checkSort(SORTABLE_JOBS_COLUMNS)
b60e5f38
C
25const videoAbusesSortValidator = checkSort(SORTABLE_VIDEO_ABUSES_COLUMNS)
26const videosSortValidator = checkSort(SORTABLE_VIDEOS_COLUMNS)
ed31c059 27const videoImportsSortValidator = checkSort(SORTABLE_VIDEO_IMPORTS_COLUMNS)
57c36b27 28const videosSearchSortValidator = checkSort(SORTABLE_VIDEOS_SEARCH_COLUMNS)
f37dc0dd 29const videoChannelsSearchSortValidator = checkSort(SORTABLE_VIDEO_CHANNELS_SEARCH_COLUMNS)
bf1f6508 30const videoCommentThreadsSortValidator = checkSort(SORTABLE_VIDEO_COMMENT_THREADS_COLUMNS)
792dbaf0 31const blacklistSortValidator = checkSort(SORTABLE_BLACKLISTS_COLUMNS)
72c7248b 32const videoChannelsSortValidator = checkSort(SORTABLE_VIDEO_CHANNELS_COLUMNS)
7a7724e6
C
33const followersSortValidator = checkSort(SORTABLE_FOLLOWERS_COLUMNS)
34const followingSortValidator = checkSort(SORTABLE_FOLLOWING_COLUMNS)
06a05d5f 35const userSubscriptionsSortValidator = checkSort(SORTABLE_USER_SUBSCRIPTIONS_COLUMNS)
7ad9b984
C
36const accountsBlocklistSortValidator = checkSort(SORTABLE_ACCOUNTS_BLOCKLIST_COLUMNS)
37const serversBlocklistSortValidator = checkSort(SORTABLE_SERVERS_BLOCKLIST_COLUMNS)
55fa55a9
C
38
39// ---------------------------------------------------------------------------
40
65fcc311
C
41export {
42 usersSortValidator,
43 videoAbusesSortValidator,
72c7248b 44 videoChannelsSortValidator,
ed31c059 45 videoImportsSortValidator,
57c36b27 46 videosSearchSortValidator,
792dbaf0 47 videosSortValidator,
7a7724e6 48 blacklistSortValidator,
265ba139 49 accountsSortValidator,
7a7724e6 50 followersSortValidator,
5cd80545 51 followingSortValidator,
bf1f6508 52 jobsSortValidator,
06a05d5f 53 videoCommentThreadsSortValidator,
f37dc0dd 54 userSubscriptionsSortValidator,
7ad9b984
C
55 videoChannelsSearchSortValidator,
56 accountsBlocklistSortValidator,
57 serversBlocklistSortValidator
65fcc311 58}