aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2020-07-23 21:30:04 +0200
committerRigel Kent <par@rigelk.eu>2020-07-29 18:15:53 +0200
commit4f5d045960b042eb27e10bac1bdaf1c074c9fa2a (patch)
tree09e1e8cce0a2e64146ede51941cfa2f1bdcf3c2f /server/controllers/api
parentbc99dfe54e093e69ba8fd06d36b36fbbda3f45de (diff)
downloadPeerTube-4f5d045960b042eb27e10bac1bdaf1c074c9fa2a.tar.gz
PeerTube-4f5d045960b042eb27e10bac1bdaf1c074c9fa2a.tar.zst
PeerTube-4f5d045960b042eb27e10bac1bdaf1c074c9fa2a.zip
harmonize search for libraries
Diffstat (limited to 'server/controllers/api')
-rw-r--r--server/controllers/api/accounts.ts3
-rw-r--r--server/controllers/api/users/my-subscriptions.ts11
-rw-r--r--server/controllers/api/video-channel.ts3
3 files changed, 12 insertions, 5 deletions
diff --git a/server/controllers/api/accounts.ts b/server/controllers/api/accounts.ts
index ccdc610a2..b1c05c6c0 100644
--- a/server/controllers/api/accounts.ts
+++ b/server/controllers/api/accounts.ts
@@ -120,7 +120,8 @@ async function listAccountChannels (req: express.Request, res: express.Response)
120 start: req.query.start, 120 start: req.query.start,
121 count: req.query.count, 121 count: req.query.count,
122 sort: req.query.sort, 122 sort: req.query.sort,
123 withStats: req.query.withStats 123 withStats: req.query.withStats,
124 search: req.query.search
124 } 125 }
125 126
126 const resultList = await VideoChannelModel.listByAccount(options) 127 const resultList = await VideoChannelModel.listByAccount(options)
diff --git a/server/controllers/api/users/my-subscriptions.ts b/server/controllers/api/users/my-subscriptions.ts
index efe1b9bc3..d207a19ae 100644
--- a/server/controllers/api/users/my-subscriptions.ts
+++ b/server/controllers/api/users/my-subscriptions.ts
@@ -13,7 +13,7 @@ import {
13 userSubscriptionAddValidator, 13 userSubscriptionAddValidator,
14 userSubscriptionGetValidator 14 userSubscriptionGetValidator
15} from '../../../middlewares' 15} from '../../../middlewares'
16import { areSubscriptionsExistValidator, userSubscriptionsSortValidator, videosSortValidator } from '../../../middlewares/validators' 16import { areSubscriptionsExistValidator, userSubscriptionsSortValidator, videosSortValidator, userSubscriptionListValidator } from '../../../middlewares/validators'
17import { VideoModel } from '../../../models/video/video' 17import { VideoModel } from '../../../models/video/video'
18import { buildNSFWFilter, getCountVideos } from '../../../helpers/express-utils' 18import { buildNSFWFilter, getCountVideos } from '../../../helpers/express-utils'
19import { VideoFilter } from '../../../../shared/models/videos/video-query.type' 19import { VideoFilter } from '../../../../shared/models/videos/video-query.type'
@@ -45,6 +45,7 @@ mySubscriptionsRouter.get('/me/subscriptions',
45 userSubscriptionsSortValidator, 45 userSubscriptionsSortValidator,
46 setDefaultSort, 46 setDefaultSort,
47 setDefaultPagination, 47 setDefaultPagination,
48 userSubscriptionListValidator,
48 asyncMiddleware(getUserSubscriptions) 49 asyncMiddleware(getUserSubscriptions)
49) 50)
50 51
@@ -141,7 +142,13 @@ async function getUserSubscriptions (req: express.Request, res: express.Response
141 const user = res.locals.oauth.token.User 142 const user = res.locals.oauth.token.User
142 const actorId = user.Account.Actor.id 143 const actorId = user.Account.Actor.id
143 144
144 const resultList = await ActorFollowModel.listSubscriptionsForApi(actorId, req.query.start, req.query.count, req.query.sort) 145 const resultList = await ActorFollowModel.listSubscriptionsForApi({
146 actorId,
147 start: req.query.start,
148 count: req.query.count,
149 sort: req.query.sort,
150 search: req.query.search
151 })
145 152
146 return res.json(getFormattedObjects(resultList.data, resultList.total)) 153 return res.json(getFormattedObjects(resultList.data, resultList.total))
147} 154}
diff --git a/server/controllers/api/video-channel.ts b/server/controllers/api/video-channel.ts
index d96998209..f705034fd 100644
--- a/server/controllers/api/video-channel.ts
+++ b/server/controllers/api/video-channel.ts
@@ -119,8 +119,7 @@ async function listVideoChannels (req: express.Request, res: express.Response) {
119 actorId: serverActor.id, 119 actorId: serverActor.id,
120 start: req.query.start, 120 start: req.query.start,
121 count: req.query.count, 121 count: req.query.count,
122 sort: req.query.sort, 122 sort: req.query.sort
123 search: req.query.search
124 }) 123 })
125 124
126 return res.json(getFormattedObjects(resultList.data, resultList.total)) 125 return res.json(getFormattedObjects(resultList.data, resultList.total))