diff options
Diffstat (limited to 'server/helpers/middlewares/video-captions.ts')
-rw-r--r-- | server/helpers/middlewares/video-captions.ts | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/server/helpers/middlewares/video-captions.ts b/server/helpers/middlewares/video-captions.ts deleted file mode 100644 index 226d3c5f8..000000000 --- a/server/helpers/middlewares/video-captions.ts +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | import { Response } from 'express' | ||
2 | import { VideoCaptionModel } from '../../models/video/video-caption' | ||
3 | import { MVideoId } from '@server/types/models' | ||
4 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' | ||
5 | |||
6 | async function doesVideoCaptionExist (video: MVideoId, language: string, res: Response) { | ||
7 | const videoCaption = await VideoCaptionModel.loadByVideoIdAndLanguage(video.id, language) | ||
8 | |||
9 | if (!videoCaption) { | ||
10 | res.status(HttpStatusCode.NOT_FOUND_404) | ||
11 | .json({ error: 'Video caption not found' }) | ||
12 | |||
13 | return false | ||
14 | } | ||
15 | |||
16 | res.locals.videoCaption = videoCaption | ||
17 | return true | ||
18 | } | ||
19 | |||
20 | // --------------------------------------------------------------------------- | ||
21 | |||
22 | export { | ||
23 | doesVideoCaptionExist | ||
24 | } | ||