aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/video-playlist.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/api/video-playlist.ts')
-rw-r--r--server/controllers/api/video-playlist.ts13
1 files changed, 7 insertions, 6 deletions
diff --git a/server/controllers/api/video-playlist.ts b/server/controllers/api/video-playlist.ts
index fb08a63b2..f3dc8b2a9 100644
--- a/server/controllers/api/video-playlist.ts
+++ b/server/controllers/api/video-playlist.ts
@@ -42,6 +42,7 @@ import {
42import { AccountModel } from '../../models/account/account' 42import { AccountModel } from '../../models/account/account'
43import { VideoPlaylistModel } from '../../models/video/video-playlist' 43import { VideoPlaylistModel } from '../../models/video/video-playlist'
44import { VideoPlaylistElementModel } from '../../models/video/video-playlist-element' 44import { VideoPlaylistElementModel } from '../../models/video/video-playlist-element'
45import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
45 46
46const reqThumbnailFile = createReqFiles([ 'thumbnailfile' ], MIMETYPES.IMAGE.MIMETYPE_EXT, { thumbnailfile: CONFIG.STORAGE.TMP_DIR }) 47const reqThumbnailFile = createReqFiles([ 'thumbnailfile' ], MIMETYPES.IMAGE.MIMETYPE_EXT, { thumbnailfile: CONFIG.STORAGE.TMP_DIR })
47 48
@@ -271,7 +272,7 @@ async function updateVideoPlaylist (req: express.Request, res: express.Response)
271 throw err 272 throw err
272 } 273 }
273 274
274 return res.type('json').status(204).end() 275 return res.type('json').status(HttpStatusCode.NO_CONTENT_204).end()
275} 276}
276 277
277async function removeVideoPlaylist (req: express.Request, res: express.Response) { 278async function removeVideoPlaylist (req: express.Request, res: express.Response) {
@@ -285,7 +286,7 @@ async function removeVideoPlaylist (req: express.Request, res: express.Response)
285 logger.info('Video playlist %s deleted.', videoPlaylistInstance.uuid) 286 logger.info('Video playlist %s deleted.', videoPlaylistInstance.uuid)
286 }) 287 })
287 288
288 return res.type('json').status(204).end() 289 return res.type('json').status(HttpStatusCode.NO_CONTENT_204).end()
289} 290}
290 291
291async function addVideoInPlaylist (req: express.Request, res: express.Response) { 292async function addVideoInPlaylist (req: express.Request, res: express.Response) {
@@ -351,7 +352,7 @@ async function updateVideoPlaylistElement (req: express.Request, res: express.Re
351 352
352 logger.info('Element of position %d of playlist %s updated.', playlistElement.position, videoPlaylist.uuid) 353 logger.info('Element of position %d of playlist %s updated.', playlistElement.position, videoPlaylist.uuid)
353 354
354 return res.type('json').status(204).end() 355 return res.type('json').status(HttpStatusCode.NO_CONTENT_204).end()
355} 356}
356 357
357async function removeVideoFromPlaylist (req: express.Request, res: express.Response) { 358async function removeVideoFromPlaylist (req: express.Request, res: express.Response) {
@@ -379,7 +380,7 @@ async function removeVideoFromPlaylist (req: express.Request, res: express.Respo
379 sendUpdateVideoPlaylist(videoPlaylist, undefined) 380 sendUpdateVideoPlaylist(videoPlaylist, undefined)
380 .catch(err => logger.error('Cannot send video playlist update.', { err })) 381 .catch(err => logger.error('Cannot send video playlist update.', { err }))
381 382
382 return res.type('json').status(204).end() 383 return res.type('json').status(HttpStatusCode.NO_CONTENT_204).end()
383} 384}
384 385
385async function reorderVideosPlaylist (req: express.Request, res: express.Response) { 386async function reorderVideosPlaylist (req: express.Request, res: express.Response) {
@@ -391,7 +392,7 @@ async function reorderVideosPlaylist (req: express.Request, res: express.Respons
391 const reorderLength: number = body.reorderLength || 1 392 const reorderLength: number = body.reorderLength || 1
392 393
393 if (start === insertAfter) { 394 if (start === insertAfter) {
394 return res.status(204).end() 395 return res.status(HttpStatusCode.NO_CONTENT_204).end()
395 } 396 }
396 397
397 // Example: if we reorder position 2 and insert after position 5 (so at position 6): # 1 2 3 4 5 6 7 8 9 398 // Example: if we reorder position 2 and insert after position 5 (so at position 6): # 1 2 3 4 5 6 7 8 9
@@ -432,7 +433,7 @@ async function reorderVideosPlaylist (req: express.Request, res: express.Respons
432 videoPlaylist.uuid, insertAfter, start, start + reorderLength - 1 433 videoPlaylist.uuid, insertAfter, start, start + reorderLength - 1
433 ) 434 )
434 435
435 return res.type('json').status(204).end() 436 return res.type('json').status(HttpStatusCode.NO_CONTENT_204).end()
436} 437}
437 438
438async function getVideoPlaylistVideos (req: express.Request, res: express.Response) { 439async function getVideoPlaylistVideos (req: express.Request, res: express.Response) {