aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/users
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
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')
-rw-r--r--server/controllers/api/users/me.ts3
-rw-r--r--server/controllers/api/users/my-subscriptions.ts19
2 files changed, 12 insertions, 10 deletions
diff --git a/server/controllers/api/users/me.ts b/server/controllers/api/users/me.ts
index 914c52e27..ba60a3d2a 100644
--- a/server/controllers/api/users/me.ts
+++ b/server/controllers/api/users/me.ts
@@ -17,6 +17,7 @@ import {
17 paginationValidator, 17 paginationValidator,
18 setDefaultPagination, 18 setDefaultPagination,
19 setDefaultSort, 19 setDefaultSort,
20 setDefaultVideosSort,
20 usersUpdateMeValidator, 21 usersUpdateMeValidator,
21 usersVideoRatingValidator 22 usersVideoRatingValidator
22} from '../../../middlewares' 23} from '../../../middlewares'
@@ -60,7 +61,7 @@ meRouter.get('/me/videos',
60 authenticate, 61 authenticate,
61 paginationValidator, 62 paginationValidator,
62 videosSortValidator, 63 videosSortValidator,
63 setDefaultSort, 64 setDefaultVideosSort,
64 setDefaultPagination, 65 setDefaultPagination,
65 asyncMiddleware(getUserVideos) 66 asyncMiddleware(getUserVideos)
66) 67)
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)