mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 19:42:24 +02:00
add video upload types, add doc middleware to more routes
This commit is contained in:
parent
fc21ef5c62
commit
c756bae079
6 changed files with 88 additions and 21 deletions
|
@ -60,12 +60,25 @@ videosRouter.use('/', liveRouter)
|
|||
videosRouter.use('/', uploadRouter)
|
||||
videosRouter.use('/', updateRouter)
|
||||
|
||||
videosRouter.get('/categories', listVideoCategories)
|
||||
videosRouter.get('/licences', listVideoLicences)
|
||||
videosRouter.get('/languages', listVideoLanguages)
|
||||
videosRouter.get('/privacies', listVideoPrivacies)
|
||||
videosRouter.get('/categories',
|
||||
openapiOperationDoc({ operationId: 'getCategories' }),
|
||||
listVideoCategories
|
||||
)
|
||||
videosRouter.get('/licences',
|
||||
openapiOperationDoc({ operationId: 'getLicences' }),
|
||||
listVideoLicences
|
||||
)
|
||||
videosRouter.get('/languages',
|
||||
openapiOperationDoc({ operationId: 'getLanguages' }),
|
||||
listVideoLanguages
|
||||
)
|
||||
videosRouter.get('/privacies',
|
||||
openapiOperationDoc({ operationId: 'getPrivacies' }),
|
||||
listVideoPrivacies
|
||||
)
|
||||
|
||||
videosRouter.get('/',
|
||||
openapiOperationDoc({ operationId: 'getVideos' }),
|
||||
paginationValidator,
|
||||
videosSortValidator,
|
||||
setDefaultVideosSort,
|
||||
|
@ -76,6 +89,7 @@ videosRouter.get('/',
|
|||
)
|
||||
|
||||
videosRouter.get('/:id/description',
|
||||
openapiOperationDoc({ operationId: 'getVideoDesc' }),
|
||||
asyncMiddleware(videosGetValidator),
|
||||
asyncMiddleware(getVideoDescription)
|
||||
)
|
||||
|
@ -91,6 +105,7 @@ videosRouter.get('/:id',
|
|||
asyncMiddleware(getVideo)
|
||||
)
|
||||
videosRouter.post('/:id/views',
|
||||
openapiOperationDoc({ operationId: 'addView' }),
|
||||
asyncMiddleware(videosCustomGetValidator('only-immutable-attributes')),
|
||||
asyncMiddleware(viewVideo)
|
||||
)
|
||||
|
|
|
@ -1,12 +1,19 @@
|
|||
import * as express from 'express'
|
||||
import { UserWatchingVideo } from '../../../../shared'
|
||||
import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate, videoWatchingValidator } from '../../../middlewares'
|
||||
import {
|
||||
asyncMiddleware,
|
||||
asyncRetryTransactionMiddleware,
|
||||
authenticate,
|
||||
openapiOperationDoc,
|
||||
videoWatchingValidator
|
||||
} from '../../../middlewares'
|
||||
import { UserVideoHistoryModel } from '../../../models/user/user-video-history'
|
||||
import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
|
||||
|
||||
const watchingRouter = express.Router()
|
||||
|
||||
watchingRouter.put('/:videoId/watching',
|
||||
openapiOperationDoc({ operationId: 'setProgress' }),
|
||||
authenticate,
|
||||
asyncMiddleware(videoWatchingValidator),
|
||||
asyncRetryTransactionMiddleware(userWatchVideo)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue