aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/accounts.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-08-20 09:19:21 +0200
committerChocobozzz <me@florianbigard.com>2020-08-20 11:05:45 +0200
commit8054669f1181e815c435e76e81247eff32d41dc5 (patch)
tree6938a880d7e71a132fa0fc5adf143a21a8b9f938 /server/controllers/api/accounts.ts
parent1c58423f6c42f494ea6358043bcb5a735b7bd5d7 (diff)
downloadPeerTube-8054669f1181e815c435e76e81247eff32d41dc5.tar.gz
PeerTube-8054669f1181e815c435e76e81247eff32d41dc5.tar.zst
PeerTube-8054669f1181e815c435e76e81247eff32d41dc5.zip
Optimize default sort when listing videos
createdAt does not have the appropriate index
Diffstat (limited to 'server/controllers/api/accounts.ts')
-rw-r--r--server/controllers/api/accounts.ts15
1 files changed, 8 insertions, 7 deletions
diff --git a/server/controllers/api/accounts.ts b/server/controllers/api/accounts.ts
index b1c05c6c0..0a73dfcbf 100644
--- a/server/controllers/api/accounts.ts
+++ b/server/controllers/api/accounts.ts
@@ -1,5 +1,8 @@
1import * as express from 'express' 1import * as express from 'express'
2import { getServerActor } from '@server/models/application/application'
3import { buildNSFWFilter, getCountVideos, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils'
2import { getFormattedObjects } from '../../helpers/utils' 4import { getFormattedObjects } from '../../helpers/utils'
5import { JobQueue } from '../../lib/job-queue'
3import { 6import {
4 asyncMiddleware, 7 asyncMiddleware,
5 authenticate, 8 authenticate,
@@ -8,6 +11,7 @@ import {
8 paginationValidator, 11 paginationValidator,
9 setDefaultPagination, 12 setDefaultPagination,
10 setDefaultSort, 13 setDefaultSort,
14 setDefaultVideosSort,
11 videoPlaylistsSortValidator, 15 videoPlaylistsSortValidator,
12 videoRatesSortValidator, 16 videoRatesSortValidator,
13 videoRatingValidator 17 videoRatingValidator
@@ -17,18 +21,15 @@ import {
17 accountsSortValidator, 21 accountsSortValidator,
18 ensureAuthUserOwnsAccountValidator, 22 ensureAuthUserOwnsAccountValidator,
19 videoChannelsSortValidator, 23 videoChannelsSortValidator,
20 videosSortValidator, 24 videoChannelStatsValidator,
21 videoChannelStatsValidator 25 videosSortValidator
22} from '../../middlewares/validators' 26} from '../../middlewares/validators'
27import { commonVideoPlaylistFiltersValidator, videoPlaylistsSearchValidator } from '../../middlewares/validators/videos/video-playlists'
23import { AccountModel } from '../../models/account/account' 28import { AccountModel } from '../../models/account/account'
24import { AccountVideoRateModel } from '../../models/account/account-video-rate' 29import { AccountVideoRateModel } from '../../models/account/account-video-rate'
25import { VideoModel } from '../../models/video/video' 30import { VideoModel } from '../../models/video/video'
26import { buildNSFWFilter, getCountVideos, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils'
27import { VideoChannelModel } from '../../models/video/video-channel' 31import { VideoChannelModel } from '../../models/video/video-channel'
28import { JobQueue } from '../../lib/job-queue'
29import { VideoPlaylistModel } from '../../models/video/video-playlist' 32import { VideoPlaylistModel } from '../../models/video/video-playlist'
30import { commonVideoPlaylistFiltersValidator, videoPlaylistsSearchValidator } from '../../middlewares/validators/videos/video-playlists'
31import { getServerActor } from '@server/models/application/application'
32 33
33const accountsRouter = express.Router() 34const accountsRouter = express.Router()
34 35
@@ -49,7 +50,7 @@ accountsRouter.get('/:accountName/videos',
49 asyncMiddleware(accountNameWithHostGetValidator), 50 asyncMiddleware(accountNameWithHostGetValidator),
50 paginationValidator, 51 paginationValidator,
51 videosSortValidator, 52 videosSortValidator,
52 setDefaultSort, 53 setDefaultVideosSort,
53 setDefaultPagination, 54 setDefaultPagination,
54 optionalAuthenticate, 55 optionalAuthenticate,
55 commonVideosFiltersValidator, 56 commonVideosFiltersValidator,