]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/middlewares/validators/sort.ts
WIP plugins: load theme on client side
[github/Chocobozzz/PeerTube.git] / server / middlewares / validators / sort.ts
CommitLineData
74dc3bca 1import { SORTABLE_COLUMNS } from '../../initializers/constants'
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)
c100a614 14const SORTABLE_VIDEO_RATES_COLUMNS = createSortableColumns(SORTABLE_COLUMNS.VIDEO_RATES)
792dbaf0 15const SORTABLE_BLACKLISTS_COLUMNS = createSortableColumns(SORTABLE_COLUMNS.BLACKLISTS)
72c7248b 16const SORTABLE_VIDEO_CHANNELS_COLUMNS = createSortableColumns(SORTABLE_COLUMNS.VIDEO_CHANNELS)
7a7724e6
C
17const SORTABLE_FOLLOWERS_COLUMNS = createSortableColumns(SORTABLE_COLUMNS.FOLLOWERS)
18const SORTABLE_FOLLOWING_COLUMNS = createSortableColumns(SORTABLE_COLUMNS.FOLLOWING)
06a05d5f 19const SORTABLE_USER_SUBSCRIPTIONS_COLUMNS = createSortableColumns(SORTABLE_COLUMNS.USER_SUBSCRIPTIONS)
7ad9b984
C
20const SORTABLE_ACCOUNTS_BLOCKLIST_COLUMNS = createSortableColumns(SORTABLE_COLUMNS.ACCOUNTS_BLOCKLIST)
21const SORTABLE_SERVERS_BLOCKLIST_COLUMNS = createSortableColumns(SORTABLE_COLUMNS.SERVERS_BLOCKLIST)
cef534ed 22const SORTABLE_USER_NOTIFICATIONS_COLUMNS = createSortableColumns(SORTABLE_COLUMNS.USER_NOTIFICATIONS)
418d092a 23const SORTABLE_VIDEO_PLAYLISTS_COLUMNS = createSortableColumns(SORTABLE_COLUMNS.VIDEO_PLAYLISTS)
5c39adb7 24
b60e5f38 25const usersSortValidator = checkSort(SORTABLE_USERS_COLUMNS)
265ba139 26const accountsSortValidator = checkSort(SORTABLE_ACCOUNTS_COLUMNS)
5cd80545 27const jobsSortValidator = checkSort(SORTABLE_JOBS_COLUMNS)
b60e5f38
C
28const videoAbusesSortValidator = checkSort(SORTABLE_VIDEO_ABUSES_COLUMNS)
29const videosSortValidator = checkSort(SORTABLE_VIDEOS_COLUMNS)
ed31c059 30const videoImportsSortValidator = checkSort(SORTABLE_VIDEO_IMPORTS_COLUMNS)
57c36b27 31const videosSearchSortValidator = checkSort(SORTABLE_VIDEOS_SEARCH_COLUMNS)
f37dc0dd 32const videoChannelsSearchSortValidator = checkSort(SORTABLE_VIDEO_CHANNELS_SEARCH_COLUMNS)
bf1f6508 33const videoCommentThreadsSortValidator = checkSort(SORTABLE_VIDEO_COMMENT_THREADS_COLUMNS)
c100a614 34const videoRatesSortValidator = checkSort(SORTABLE_VIDEO_RATES_COLUMNS)
792dbaf0 35const blacklistSortValidator = checkSort(SORTABLE_BLACKLISTS_COLUMNS)
72c7248b 36const videoChannelsSortValidator = checkSort(SORTABLE_VIDEO_CHANNELS_COLUMNS)
7a7724e6
C
37const followersSortValidator = checkSort(SORTABLE_FOLLOWERS_COLUMNS)
38const followingSortValidator = checkSort(SORTABLE_FOLLOWING_COLUMNS)
06a05d5f 39const userSubscriptionsSortValidator = checkSort(SORTABLE_USER_SUBSCRIPTIONS_COLUMNS)
7ad9b984
C
40const accountsBlocklistSortValidator = checkSort(SORTABLE_ACCOUNTS_BLOCKLIST_COLUMNS)
41const serversBlocklistSortValidator = checkSort(SORTABLE_SERVERS_BLOCKLIST_COLUMNS)
cef534ed 42const userNotificationsSortValidator = checkSort(SORTABLE_USER_NOTIFICATIONS_COLUMNS)
418d092a 43const videoPlaylistsSortValidator = checkSort(SORTABLE_VIDEO_PLAYLISTS_COLUMNS)
55fa55a9
C
44
45// ---------------------------------------------------------------------------
46
65fcc311
C
47export {
48 usersSortValidator,
49 videoAbusesSortValidator,
72c7248b 50 videoChannelsSortValidator,
ed31c059 51 videoImportsSortValidator,
57c36b27 52 videosSearchSortValidator,
792dbaf0 53 videosSortValidator,
7a7724e6 54 blacklistSortValidator,
265ba139 55 accountsSortValidator,
7a7724e6 56 followersSortValidator,
5cd80545 57 followingSortValidator,
bf1f6508 58 jobsSortValidator,
06a05d5f 59 videoCommentThreadsSortValidator,
c100a614 60 videoRatesSortValidator,
f37dc0dd 61 userSubscriptionsSortValidator,
7ad9b984
C
62 videoChannelsSearchSortValidator,
63 accountsBlocklistSortValidator,
cef534ed 64 serversBlocklistSortValidator,
418d092a
C
65 userNotificationsSortValidator,
66 videoPlaylistsSortValidator
65fcc311 67}