mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-04 10:19:35 +02:00
Add ability to list video imports
This commit is contained in:
parent
299474e827
commit
ed31c05985
17 changed files with 283 additions and 19 deletions
|
@ -29,7 +29,12 @@ import {
|
|||
usersUpdateValidator,
|
||||
usersVideoRatingValidator
|
||||
} from '../../middlewares'
|
||||
import { usersAskResetPasswordValidator, usersResetPasswordValidator, videosSortValidator } from '../../middlewares/validators'
|
||||
import {
|
||||
usersAskResetPasswordValidator,
|
||||
usersResetPasswordValidator,
|
||||
videoImportsSortValidator,
|
||||
videosSortValidator
|
||||
} from '../../middlewares/validators'
|
||||
import { AccountVideoRateModel } from '../../models/account/account-video-rate'
|
||||
import { UserModel } from '../../models/account/user'
|
||||
import { OAuthTokenModel } from '../../models/oauth/oauth-token'
|
||||
|
@ -40,6 +45,7 @@ import { UserVideoQuota } from '../../../shared/models/users/user-video-quota.mo
|
|||
import { updateAvatarValidator } from '../../middlewares/validators/avatar'
|
||||
import { updateActorAvatarFile } from '../../lib/avatar'
|
||||
import { auditLoggerFactory, UserAuditView } from '../../helpers/audit-logger'
|
||||
import { VideoImportModel } from '../../models/video/video-import'
|
||||
|
||||
const auditLogger = auditLoggerFactory('users')
|
||||
|
||||
|
@ -62,6 +68,16 @@ usersRouter.get('/me/video-quota-used',
|
|||
asyncMiddleware(getUserVideoQuotaUsed)
|
||||
)
|
||||
|
||||
|
||||
usersRouter.get('/me/videos/imports',
|
||||
authenticate,
|
||||
paginationValidator,
|
||||
videoImportsSortValidator,
|
||||
setDefaultSort,
|
||||
setDefaultPagination,
|
||||
asyncMiddleware(getUserVideoImports)
|
||||
)
|
||||
|
||||
usersRouter.get('/me/videos',
|
||||
authenticate,
|
||||
paginationValidator,
|
||||
|
@ -178,6 +194,18 @@ async function getUserVideos (req: express.Request, res: express.Response, next:
|
|||
return res.json(getFormattedObjects(resultList.data, resultList.total, { additionalAttributes }))
|
||||
}
|
||||
|
||||
async function getUserVideoImports (req: express.Request, res: express.Response, next: express.NextFunction) {
|
||||
const user = res.locals.oauth.token.User as UserModel
|
||||
const resultList = await VideoImportModel.listUserVideoImportsForApi(
|
||||
user.Account.id,
|
||||
req.query.start as number,
|
||||
req.query.count as number,
|
||||
req.query.sort
|
||||
)
|
||||
|
||||
return res.json(getFormattedObjects(resultList.data, resultList.total))
|
||||
}
|
||||
|
||||
async function createUser (req: express.Request, res: express.Response) {
|
||||
const body: UserCreate = req.body
|
||||
const userToCreate = new UserModel({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue