1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 02:39:33 +02:00

Add ability to filter my imports by target URL

This commit is contained in:
Chocobozzz 2022-01-19 14:58:16 +01:00
parent 419b520ca4
commit d511df2890
No known key found for this signature in database
GPG key ID: 583A612D890159BE
6 changed files with 59 additions and 20 deletions

View file

@ -30,6 +30,7 @@ import { AccountVideoRateModel } from '../../../models/account/account-video-rat
import { UserModel } from '../../../models/user/user'
import { VideoModel } from '../../../models/video/video'
import { VideoImportModel } from '../../../models/video/video-import'
import { pick } from '@shared/core-utils'
const auditLogger = auditLoggerFactory('users')
@ -133,12 +134,11 @@ async function getUserVideos (req: express.Request, res: express.Response) {
async function getUserVideoImports (req: express.Request, res: express.Response) {
const user = res.locals.oauth.token.User
const resultList = await VideoImportModel.listUserVideoImportsForApi(
user.id,
req.query.start as number,
req.query.count as number,
req.query.sort
)
const resultList = await VideoImportModel.listUserVideoImportsForApi({
userId: user.id,
...pick(req.query, [ 'targetUrl', 'start', 'count', 'sort' ])
})
return res.json(getFormattedObjects(resultList.data, resultList.total))
}