diff options
author | Chocobozzz <me@florianbigard.com> | 2021-06-02 18:15:41 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-06-02 18:15:41 +0200 |
commit | e030bfb59dd5ee65f20a64686ec9b22ca39f70ae (patch) | |
tree | c9a439159ef540291e3c030bcaf958b953442147 /server/controllers/api/videos/index.ts | |
parent | 463206948d6a9d46e7e68d55c7b763e601ecc870 (diff) | |
download | PeerTube-e030bfb59dd5ee65f20a64686ec9b22ca39f70ae.tar.gz PeerTube-e030bfb59dd5ee65f20a64686ec9b22ca39f70ae.tar.zst PeerTube-e030bfb59dd5ee65f20a64686ec9b22ca39f70ae.zip |
Refactor server errors handler
Diffstat (limited to 'server/controllers/api/videos/index.ts')
-rw-r--r-- | server/controllers/api/videos/index.ts | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts index db23e5630..7671f099e 100644 --- a/server/controllers/api/videos/index.ts +++ b/server/controllers/api/videos/index.ts | |||
@@ -2,6 +2,7 @@ import * as express from 'express' | |||
2 | import toInt from 'validator/lib/toInt' | 2 | import toInt from 'validator/lib/toInt' |
3 | import { doJSONRequest } from '@server/helpers/requests' | 3 | import { doJSONRequest } from '@server/helpers/requests' |
4 | import { LiveManager } from '@server/lib/live-manager' | 4 | import { LiveManager } from '@server/lib/live-manager' |
5 | import { docMiddleware } from '@server/middlewares/doc' | ||
5 | import { getServerActor } from '@server/models/application/application' | 6 | import { getServerActor } from '@server/models/application/application' |
6 | import { MVideoAccountLight } from '@server/types/models' | 7 | import { MVideoAccountLight } from '@server/types/models' |
7 | import { VideosCommonQuery } from '../../../../shared' | 8 | import { VideosCommonQuery } from '../../../../shared' |
@@ -83,6 +84,7 @@ videosRouter.get('/:id/metadata/:videoFileId', | |||
83 | asyncMiddleware(getVideoFileMetadata) | 84 | asyncMiddleware(getVideoFileMetadata) |
84 | ) | 85 | ) |
85 | videosRouter.get('/:id', | 86 | videosRouter.get('/:id', |
87 | docMiddleware('https://docs.joinpeertube.org/api-rest-reference.html#operation/getVideo'), | ||
86 | optionalAuthenticate, | 88 | optionalAuthenticate, |
87 | asyncMiddleware(videosCustomGetValidator('only-video-with-rights')), | 89 | asyncMiddleware(videosCustomGetValidator('only-video-with-rights')), |
88 | asyncMiddleware(checkVideoFollowConstraints), | 90 | asyncMiddleware(checkVideoFollowConstraints), |
@@ -94,6 +96,7 @@ videosRouter.post('/:id/views', | |||
94 | ) | 96 | ) |
95 | 97 | ||
96 | videosRouter.delete('/:id', | 98 | videosRouter.delete('/:id', |
99 | docMiddleware('https://docs.joinpeertube.org/api-rest-reference.html#operation/delVideo'), | ||
97 | authenticate, | 100 | authenticate, |
98 | asyncMiddleware(videosRemoveValidator), | 101 | asyncMiddleware(videosRemoveValidator), |
99 | asyncRetryTransactionMiddleware(removeVideo) | 102 | asyncRetryTransactionMiddleware(removeVideo) |