diff options
Diffstat (limited to 'server/controllers/api/videos')
-rw-r--r-- | server/controllers/api/videos/index.ts | 23 | ||||
-rw-r--r-- | server/controllers/api/videos/watching.ts | 9 |
2 files changed, 27 insertions, 5 deletions
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts index 703051ee2..8c6c44144 100644 --- a/server/controllers/api/videos/index.ts +++ b/server/controllers/api/videos/index.ts | |||
@@ -60,12 +60,25 @@ videosRouter.use('/', liveRouter) | |||
60 | videosRouter.use('/', uploadRouter) | 60 | videosRouter.use('/', uploadRouter) |
61 | videosRouter.use('/', updateRouter) | 61 | videosRouter.use('/', updateRouter) |
62 | 62 | ||
63 | videosRouter.get('/categories', listVideoCategories) | 63 | videosRouter.get('/categories', |
64 | videosRouter.get('/licences', listVideoLicences) | 64 | openapiOperationDoc({ operationId: 'getCategories' }), |
65 | videosRouter.get('/languages', listVideoLanguages) | 65 | listVideoCategories |
66 | videosRouter.get('/privacies', listVideoPrivacies) | 66 | ) |
67 | videosRouter.get('/licences', | ||
68 | openapiOperationDoc({ operationId: 'getLicences' }), | ||
69 | listVideoLicences | ||
70 | ) | ||
71 | videosRouter.get('/languages', | ||
72 | openapiOperationDoc({ operationId: 'getLanguages' }), | ||
73 | listVideoLanguages | ||
74 | ) | ||
75 | videosRouter.get('/privacies', | ||
76 | openapiOperationDoc({ operationId: 'getPrivacies' }), | ||
77 | listVideoPrivacies | ||
78 | ) | ||
67 | 79 | ||
68 | videosRouter.get('/', | 80 | videosRouter.get('/', |
81 | openapiOperationDoc({ operationId: 'getVideos' }), | ||
69 | paginationValidator, | 82 | paginationValidator, |
70 | videosSortValidator, | 83 | videosSortValidator, |
71 | setDefaultVideosSort, | 84 | setDefaultVideosSort, |
@@ -76,6 +89,7 @@ videosRouter.get('/', | |||
76 | ) | 89 | ) |
77 | 90 | ||
78 | videosRouter.get('/:id/description', | 91 | videosRouter.get('/:id/description', |
92 | openapiOperationDoc({ operationId: 'getVideoDesc' }), | ||
79 | asyncMiddleware(videosGetValidator), | 93 | asyncMiddleware(videosGetValidator), |
80 | asyncMiddleware(getVideoDescription) | 94 | asyncMiddleware(getVideoDescription) |
81 | ) | 95 | ) |
@@ -91,6 +105,7 @@ videosRouter.get('/:id', | |||
91 | asyncMiddleware(getVideo) | 105 | asyncMiddleware(getVideo) |
92 | ) | 106 | ) |
93 | videosRouter.post('/:id/views', | 107 | videosRouter.post('/:id/views', |
108 | openapiOperationDoc({ operationId: 'addView' }), | ||
94 | asyncMiddleware(videosCustomGetValidator('only-immutable-attributes')), | 109 | asyncMiddleware(videosCustomGetValidator('only-immutable-attributes')), |
95 | asyncMiddleware(viewVideo) | 110 | asyncMiddleware(viewVideo) |
96 | ) | 111 | ) |
diff --git a/server/controllers/api/videos/watching.ts b/server/controllers/api/videos/watching.ts index 08190e583..8b15525aa 100644 --- a/server/controllers/api/videos/watching.ts +++ b/server/controllers/api/videos/watching.ts | |||
@@ -1,12 +1,19 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { UserWatchingVideo } from '../../../../shared' | 2 | import { UserWatchingVideo } from '../../../../shared' |
3 | import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate, videoWatchingValidator } from '../../../middlewares' | 3 | import { |
4 | asyncMiddleware, | ||
5 | asyncRetryTransactionMiddleware, | ||
6 | authenticate, | ||
7 | openapiOperationDoc, | ||
8 | videoWatchingValidator | ||
9 | } from '../../../middlewares' | ||
4 | import { UserVideoHistoryModel } from '../../../models/user/user-video-history' | 10 | import { UserVideoHistoryModel } from '../../../models/user/user-video-history' |
5 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | 11 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' |
6 | 12 | ||
7 | const watchingRouter = express.Router() | 13 | const watchingRouter = express.Router() |
8 | 14 | ||
9 | watchingRouter.put('/:videoId/watching', | 15 | watchingRouter.put('/:videoId/watching', |
16 | openapiOperationDoc({ operationId: 'setProgress' }), | ||
10 | authenticate, | 17 | authenticate, |
11 | asyncMiddleware(videoWatchingValidator), | 18 | asyncMiddleware(videoWatchingValidator), |
12 | asyncRetryTransactionMiddleware(userWatchVideo) | 19 | asyncRetryTransactionMiddleware(userWatchVideo) |