aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/users
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/api/users')
-rw-r--r--server/controllers/api/users/my-history.ts3
-rw-r--r--server/controllers/api/users/my-video-playlists.ts5
2 files changed, 5 insertions, 3 deletions
diff --git a/server/controllers/api/users/my-history.ts b/server/controllers/api/users/my-history.ts
index bc5b40f59..e6d3e86ac 100644
--- a/server/controllers/api/users/my-history.ts
+++ b/server/controllers/api/users/my-history.ts
@@ -1,3 +1,4 @@
1import { forceNumber } from '@shared/core-utils'
1import express from 'express' 2import express from 'express'
2import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' 3import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
3import { getFormattedObjects } from '../../../helpers/utils' 4import { getFormattedObjects } from '../../../helpers/utils'
@@ -55,7 +56,7 @@ async function listMyVideosHistory (req: express.Request, res: express.Response)
55async function removeUserHistoryElement (req: express.Request, res: express.Response) { 56async function removeUserHistoryElement (req: express.Request, res: express.Response) {
56 const user = res.locals.oauth.token.User 57 const user = res.locals.oauth.token.User
57 58
58 await UserVideoHistoryModel.removeUserHistoryElement(user, parseInt(req.params.videoId + '')) 59 await UserVideoHistoryModel.removeUserHistoryElement(user, forceNumber(req.params.videoId))
59 60
60 return res.sendStatus(HttpStatusCode.NO_CONTENT_204) 61 return res.sendStatus(HttpStatusCode.NO_CONTENT_204)
61} 62}
diff --git a/server/controllers/api/users/my-video-playlists.ts b/server/controllers/api/users/my-video-playlists.ts
index 715717610..fbdbb7e50 100644
--- a/server/controllers/api/users/my-video-playlists.ts
+++ b/server/controllers/api/users/my-video-playlists.ts
@@ -1,5 +1,6 @@
1import { uuidToShort } from '@shared/extra-utils'
2import express from 'express' 1import express from 'express'
2import { forceNumber } from '@shared/core-utils'
3import { uuidToShort } from '@shared/extra-utils'
3import { VideosExistInPlaylists } from '../../../../shared/models/videos/playlist/video-exist-in-playlist.model' 4import { VideosExistInPlaylists } from '../../../../shared/models/videos/playlist/video-exist-in-playlist.model'
4import { asyncMiddleware, authenticate } from '../../../middlewares' 5import { asyncMiddleware, authenticate } from '../../../middlewares'
5import { doVideosInPlaylistExistValidator } from '../../../middlewares/validators/videos/video-playlists' 6import { doVideosInPlaylistExistValidator } from '../../../middlewares/validators/videos/video-playlists'
@@ -22,7 +23,7 @@ export {
22// --------------------------------------------------------------------------- 23// ---------------------------------------------------------------------------
23 24
24async function doVideosInPlaylistExist (req: express.Request, res: express.Response) { 25async function doVideosInPlaylistExist (req: express.Request, res: express.Response) {
25 const videoIds = req.query.videoIds.map(i => parseInt(i + '', 10)) 26 const videoIds = req.query.videoIds.map(i => forceNumber(i))
26 const user = res.locals.oauth.token.User 27 const user = res.locals.oauth.token.User
27 28
28 const results = await VideoPlaylistModel.listPlaylistSummariesOf(user.Account.id, videoIds) 29 const results = await VideoPlaylistModel.listPlaylistSummariesOf(user.Account.id, videoIds)