diff options
author | Chocobozzz <me@florianbigard.com> | 2020-08-20 09:19:21 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-08-20 11:05:45 +0200 |
commit | 8054669f1181e815c435e76e81247eff32d41dc5 (patch) | |
tree | 6938a880d7e71a132fa0fc5adf143a21a8b9f938 /server/controllers/api/users/my-subscriptions.ts | |
parent | 1c58423f6c42f494ea6358043bcb5a735b7bd5d7 (diff) | |
download | PeerTube-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.ts | 19 |
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 @@ | |||
1 | import * as express from 'express' | ||
2 | import 'multer' | 1 | import 'multer' |
2 | import * as express from 'express' | ||
3 | import { VideoFilter } from '../../../../shared/models/videos/video-query.type' | ||
4 | import { buildNSFWFilter, getCountVideos } from '../../../helpers/express-utils' | ||
3 | import { getFormattedObjects } from '../../../helpers/utils' | 5 | import { getFormattedObjects } from '../../../helpers/utils' |
4 | import { WEBSERVER } from '../../../initializers/constants' | 6 | import { WEBSERVER } from '../../../initializers/constants' |
7 | import { sequelizeTypescript } from '../../../initializers/database' | ||
8 | import { JobQueue } from '../../../lib/job-queue' | ||
5 | import { | 9 | import { |
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' |
16 | import { | 21 | import { |
17 | areSubscriptionsExistValidator, | 22 | areSubscriptionsExistValidator, |
23 | userSubscriptionListValidator, | ||
18 | userSubscriptionsSortValidator, | 24 | userSubscriptionsSortValidator, |
19 | videosSortValidator, | 25 | videosSortValidator |
20 | userSubscriptionListValidator | ||
21 | } from '../../../middlewares/validators' | 26 | } from '../../../middlewares/validators' |
22 | import { VideoModel } from '../../../models/video/video' | ||
23 | import { buildNSFWFilter, getCountVideos } from '../../../helpers/express-utils' | ||
24 | import { VideoFilter } from '../../../../shared/models/videos/video-query.type' | ||
25 | import { ActorFollowModel } from '../../../models/activitypub/actor-follow' | 27 | import { ActorFollowModel } from '../../../models/activitypub/actor-follow' |
26 | import { JobQueue } from '../../../lib/job-queue' | 28 | import { VideoModel } from '../../../models/video/video' |
27 | import { sequelizeTypescript } from '../../../initializers/database' | ||
28 | 29 | ||
29 | const mySubscriptionsRouter = express.Router() | 30 | const 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) |