mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-04 02:09:37 +02:00
replace numbers with typed http status codes (#3409)
This commit is contained in:
parent
adc1f09c0d
commit
2d53be0267
149 changed files with 1721 additions and 1108 deletions
|
@ -42,6 +42,7 @@ import {
|
|||
import { AccountModel } from '../../models/account/account'
|
||||
import { VideoPlaylistModel } from '../../models/video/video-playlist'
|
||||
import { VideoPlaylistElementModel } from '../../models/video/video-playlist-element'
|
||||
import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
|
||||
|
||||
const reqThumbnailFile = createReqFiles([ 'thumbnailfile' ], MIMETYPES.IMAGE.MIMETYPE_EXT, { thumbnailfile: CONFIG.STORAGE.TMP_DIR })
|
||||
|
||||
|
@ -271,7 +272,7 @@ async function updateVideoPlaylist (req: express.Request, res: express.Response)
|
|||
throw err
|
||||
}
|
||||
|
||||
return res.type('json').status(204).end()
|
||||
return res.type('json').status(HttpStatusCode.NO_CONTENT_204).end()
|
||||
}
|
||||
|
||||
async function removeVideoPlaylist (req: express.Request, res: express.Response) {
|
||||
|
@ -285,7 +286,7 @@ async function removeVideoPlaylist (req: express.Request, res: express.Response)
|
|||
logger.info('Video playlist %s deleted.', videoPlaylistInstance.uuid)
|
||||
})
|
||||
|
||||
return res.type('json').status(204).end()
|
||||
return res.type('json').status(HttpStatusCode.NO_CONTENT_204).end()
|
||||
}
|
||||
|
||||
async function addVideoInPlaylist (req: express.Request, res: express.Response) {
|
||||
|
@ -351,7 +352,7 @@ async function updateVideoPlaylistElement (req: express.Request, res: express.Re
|
|||
|
||||
logger.info('Element of position %d of playlist %s updated.', playlistElement.position, videoPlaylist.uuid)
|
||||
|
||||
return res.type('json').status(204).end()
|
||||
return res.type('json').status(HttpStatusCode.NO_CONTENT_204).end()
|
||||
}
|
||||
|
||||
async function removeVideoFromPlaylist (req: express.Request, res: express.Response) {
|
||||
|
@ -379,7 +380,7 @@ async function removeVideoFromPlaylist (req: express.Request, res: express.Respo
|
|||
sendUpdateVideoPlaylist(videoPlaylist, undefined)
|
||||
.catch(err => logger.error('Cannot send video playlist update.', { err }))
|
||||
|
||||
return res.type('json').status(204).end()
|
||||
return res.type('json').status(HttpStatusCode.NO_CONTENT_204).end()
|
||||
}
|
||||
|
||||
async function reorderVideosPlaylist (req: express.Request, res: express.Response) {
|
||||
|
@ -391,7 +392,7 @@ async function reorderVideosPlaylist (req: express.Request, res: express.Respons
|
|||
const reorderLength: number = body.reorderLength || 1
|
||||
|
||||
if (start === insertAfter) {
|
||||
return res.status(204).end()
|
||||
return res.status(HttpStatusCode.NO_CONTENT_204).end()
|
||||
}
|
||||
|
||||
// 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
|
|||
videoPlaylist.uuid, insertAfter, start, start + reorderLength - 1
|
||||
)
|
||||
|
||||
return res.type('json').status(204).end()
|
||||
return res.type('json').status(HttpStatusCode.NO_CONTENT_204).end()
|
||||
}
|
||||
|
||||
async function getVideoPlaylistVideos (req: express.Request, res: express.Response) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue