diff options
author | Chocobozzz <me@florianbigard.com> | 2019-07-23 10:40:39 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2019-07-24 10:58:16 +0200 |
commit | 3e753302d8c911b59971c16a8018df0e1ab78465 (patch) | |
tree | efce7ece3273589228c5c948ea6757b2bdf65429 /server/helpers/custom-validators/video-playlists.ts | |
parent | a8b666e9f1ed002230869606308749614390c82f (diff) | |
download | PeerTube-3e753302d8c911b59971c16a8018df0e1ab78465.tar.gz PeerTube-3e753302d8c911b59971c16a8018df0e1ab78465.tar.zst PeerTube-3e753302d8c911b59971c16a8018df0e1ab78465.zip |
Refactor middleware helpers
Diffstat (limited to 'server/helpers/custom-validators/video-playlists.ts')
-rw-r--r-- | server/helpers/custom-validators/video-playlists.ts | 18 |
1 files changed, 0 insertions, 18 deletions
diff --git a/server/helpers/custom-validators/video-playlists.ts b/server/helpers/custom-validators/video-playlists.ts index 2fe426560..60125dcda 100644 --- a/server/helpers/custom-validators/video-playlists.ts +++ b/server/helpers/custom-validators/video-playlists.ts | |||
@@ -26,27 +26,9 @@ function isVideoPlaylistTypeValid (value: any) { | |||
26 | return exists(value) && VIDEO_PLAYLIST_TYPES[ value ] !== undefined | 26 | return exists(value) && VIDEO_PLAYLIST_TYPES[ value ] !== undefined |
27 | } | 27 | } |
28 | 28 | ||
29 | async function doesVideoPlaylistExist (id: number | string, res: express.Response, fetchType: 'summary' | 'all' = 'summary') { | ||
30 | const videoPlaylist = fetchType === 'summary' | ||
31 | ? await VideoPlaylistModel.loadWithAccountAndChannelSummary(id, undefined) | ||
32 | : await VideoPlaylistModel.loadWithAccountAndChannel(id, undefined) | ||
33 | |||
34 | if (!videoPlaylist) { | ||
35 | res.status(404) | ||
36 | .json({ error: 'Video playlist not found' }) | ||
37 | .end() | ||
38 | |||
39 | return false | ||
40 | } | ||
41 | |||
42 | res.locals.videoPlaylist = videoPlaylist | ||
43 | return true | ||
44 | } | ||
45 | |||
46 | // --------------------------------------------------------------------------- | 29 | // --------------------------------------------------------------------------- |
47 | 30 | ||
48 | export { | 31 | export { |
49 | doesVideoPlaylistExist, | ||
50 | isVideoPlaylistNameValid, | 32 | isVideoPlaylistNameValid, |
51 | isVideoPlaylistDescriptionValid, | 33 | isVideoPlaylistDescriptionValid, |
52 | isVideoPlaylistPrivacyValid, | 34 | isVideoPlaylistPrivacyValid, |