aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/users/my-subscriptions.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/users/my-subscriptions.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/users/my-subscriptions.ts')
-rw-r--r--server/controllers/api/users/my-subscriptions.ts19
1 files changed, 10 insertions, 9 deletions
diff --git a/server/controllers/api/users/my-subscriptions.ts b/server/controllers/api/users/my-subscriptions.ts
index 8b88feaf3..b8c234eef 100644
--- a/server/controllers/api/users/my-subscriptions.ts
+++ b/server/controllers/api/users/my-subscriptions.ts
@@ -1,7 +1,11 @@
1import * as express from 'express'
2import 'multer' 1import 'multer'
2import * as express from 'express'
3import { VideoFilter } from '../../../../shared/models/videos/video-query.type'
4import { buildNSFWFilter, getCountVideos } from '../../../helpers/express-utils'
3import { getFormattedObjects } from '../../../helpers/utils' 5import { getFormattedObjects } from '../../../helpers/utils'
4import { WEBSERVER } from '../../../initializers/constants' 6import { WEBSERVER } from '../../../initializers/constants'
7import { sequelizeTypescript } from '../../../initializers/database'
8import { JobQueue } from '../../../lib/job-queue'
5import { 9import {
6 asyncMiddleware, 10 asyncMiddleware,
7 asyncRetryTransactionMiddleware, 11 asyncRetryTransactionMiddleware,
@@ -10,21 +14,18 @@ import {
10 paginationValidator, 14 paginationValidator,
11 setDefaultPagination, 15 setDefaultPagination,
12 setDefaultSort, 16 setDefaultSort,
17 setDefaultVideosSort,
13 userSubscriptionAddValidator, 18 userSubscriptionAddValidator,
14 userSubscriptionGetValidator 19 userSubscriptionGetValidator
15} from '../../../middlewares' 20} from '../../../middlewares'
16import { 21import {
17 areSubscriptionsExistValidator, 22 areSubscriptionsExistValidator,
23 userSubscriptionListValidator,
18 userSubscriptionsSortValidator, 24 userSubscriptionsSortValidator,
19 videosSortValidator, 25 videosSortValidator
20 userSubscriptionListValidator
21} from '../../../middlewares/validators' 26} from '../../../middlewares/validators'
22import { VideoModel } from '../../../models/video/video'
23import { buildNSFWFilter, getCountVideos } from '../../../helpers/express-utils'
24import { VideoFilter } from '../../../../shared/models/videos/video-query.type'
25import { ActorFollowModel } from '../../../models/activitypub/actor-follow' 27import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
26import { JobQueue } from '../../../lib/job-queue' 28import { VideoModel } from '../../../models/video/video'
27import { sequelizeTypescript } from '../../../initializers/database'
28 29
29const mySubscriptionsRouter = express.Router() 30const mySubscriptionsRouter = express.Router()
30 31
@@ -32,7 +33,7 @@ mySubscriptionsRouter.get('/me/subscriptions/videos',
32 authenticate, 33 authenticate,
33 paginationValidator, 34 paginationValidator,
34 videosSortValidator, 35 videosSortValidator,
35 setDefaultSort, 36 setDefaultVideosSort,
36 setDefaultPagination, 37 setDefaultPagination,
37 commonVideosFiltersValidator, 38 commonVideosFiltersValidator,
38 asyncMiddleware(getUserSubscriptionVideos) 39 asyncMiddleware(getUserSubscriptionVideos)