diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2021-01-13 09:16:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-13 09:16:15 +0100 |
commit | d8b34ee55b654912f86bb8b472d391ced8c28f64 (patch) | |
tree | efa2b8ac36c00fa6e9b5af3f13e54a47bc7a7701 /server/controllers/api | |
parent | 22078471fbe5a4dea6177bd1fa19da1cf887679e (diff) | |
download | PeerTube-d8b34ee55b654912f86bb8b472d391ced8c28f64.tar.gz PeerTube-d8b34ee55b654912f86bb8b472d391ced8c28f64.tar.zst PeerTube-d8b34ee55b654912f86bb8b472d391ced8c28f64.zip |
Allow user to search through their watch history (#3576)
* allow user to search through their watch history
* add tests for search in watch history
* Update client/src/app/shared/shared-main/users/user-history.service.ts
Diffstat (limited to 'server/controllers/api')
-rw-r--r-- | server/controllers/api/users/my-history.ts | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/server/controllers/api/users/my-history.ts b/server/controllers/api/users/my-history.ts index 80d4dc748..72c7da373 100644 --- a/server/controllers/api/users/my-history.ts +++ b/server/controllers/api/users/my-history.ts | |||
@@ -5,6 +5,7 @@ import { | |||
5 | authenticate, | 5 | authenticate, |
6 | paginationValidator, | 6 | paginationValidator, |
7 | setDefaultPagination, | 7 | setDefaultPagination, |
8 | userHistoryListValidator, | ||
8 | userHistoryRemoveValidator | 9 | userHistoryRemoveValidator |
9 | } from '../../../middlewares' | 10 | } from '../../../middlewares' |
10 | import { getFormattedObjects } from '../../../helpers/utils' | 11 | import { getFormattedObjects } from '../../../helpers/utils' |
@@ -18,6 +19,7 @@ myVideosHistoryRouter.get('/me/history/videos', | |||
18 | authenticate, | 19 | authenticate, |
19 | paginationValidator, | 20 | paginationValidator, |
20 | setDefaultPagination, | 21 | setDefaultPagination, |
22 | userHistoryListValidator, | ||
21 | asyncMiddleware(listMyVideosHistory) | 23 | asyncMiddleware(listMyVideosHistory) |
22 | ) | 24 | ) |
23 | 25 | ||
@@ -38,7 +40,7 @@ export { | |||
38 | async function listMyVideosHistory (req: express.Request, res: express.Response) { | 40 | async function listMyVideosHistory (req: express.Request, res: express.Response) { |
39 | const user = res.locals.oauth.token.User | 41 | const user = res.locals.oauth.token.User |
40 | 42 | ||
41 | const resultList = await UserVideoHistoryModel.listForApi(user, req.query.start, req.query.count) | 43 | const resultList = await UserVideoHistoryModel.listForApi(user, req.query.start, req.query.count, req.query.search) |
42 | 44 | ||
43 | return res.json(getFormattedObjects(resultList.data, resultList.total)) | 45 | return res.json(getFormattedObjects(resultList.data, resultList.total)) |
44 | } | 46 | } |