aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-08-10 11:51:13 +0200
committerChocobozzz <me@florianbigard.com>2022-08-10 14:32:00 +0200
commita3b472a12ec6e57dbe2f650419f8064864686eab (patch)
treef36559488e34493c029b686772e986902150a647 /server/controllers
parent0567049a9819d67070aa6d548a75a7e632a4aaa4 (diff)
downloadPeerTube-a3b472a12ec6e57dbe2f650419f8064864686eab.tar.gz
PeerTube-a3b472a12ec6e57dbe2f650419f8064864686eab.tar.zst
PeerTube-a3b472a12ec6e57dbe2f650419f8064864686eab.zip
Add ability to list imports of a channel sync
Diffstat (limited to 'server/controllers')
-rw-r--r--server/controllers/api/users/me.ts11
-rw-r--r--server/controllers/api/video-channel.ts9
2 files changed, 14 insertions, 6 deletions
diff --git a/server/controllers/api/users/me.ts b/server/controllers/api/users/me.ts
index 595abcf95..00f580ee9 100644
--- a/server/controllers/api/users/me.ts
+++ b/server/controllers/api/users/me.ts
@@ -25,7 +25,13 @@ import {
25 usersUpdateMeValidator, 25 usersUpdateMeValidator,
26 usersVideoRatingValidator 26 usersVideoRatingValidator
27} from '../../../middlewares' 27} from '../../../middlewares'
28import { deleteMeValidator, usersVideosValidator, videoImportsSortValidator, videosSortValidator } from '../../../middlewares/validators' 28import {
29 deleteMeValidator,
30 getMyVideoImportsValidator,
31 usersVideosValidator,
32 videoImportsSortValidator,
33 videosSortValidator
34} from '../../../middlewares/validators'
29import { updateAvatarValidator } from '../../../middlewares/validators/actor-image' 35import { updateAvatarValidator } from '../../../middlewares/validators/actor-image'
30import { AccountModel } from '../../../models/account/account' 36import { AccountModel } from '../../../models/account/account'
31import { AccountVideoRateModel } from '../../../models/account/account-video-rate' 37import { AccountVideoRateModel } from '../../../models/account/account-video-rate'
@@ -60,6 +66,7 @@ meRouter.get('/me/videos/imports',
60 videoImportsSortValidator, 66 videoImportsSortValidator,
61 setDefaultSort, 67 setDefaultSort,
62 setDefaultPagination, 68 setDefaultPagination,
69 getMyVideoImportsValidator,
63 asyncMiddleware(getUserVideoImports) 70 asyncMiddleware(getUserVideoImports)
64) 71)
65 72
@@ -138,7 +145,7 @@ async function getUserVideoImports (req: express.Request, res: express.Response)
138 const resultList = await VideoImportModel.listUserVideoImportsForApi({ 145 const resultList = await VideoImportModel.listUserVideoImportsForApi({
139 userId: user.id, 146 userId: user.id,
140 147
141 ...pick(req.query, [ 'targetUrl', 'start', 'count', 'sort' ]) 148 ...pick(req.query, [ 'targetUrl', 'start', 'count', 'sort', 'search', 'videoChannelSyncId' ])
142 }) 149 })
143 150
144 return res.json(getFormattedObjects(resultList.data, resultList.total)) 151 return res.json(getFormattedObjects(resultList.data, resultList.total))
diff --git a/server/controllers/api/video-channel.ts b/server/controllers/api/video-channel.ts
index 89c7181bd..94285a78d 100644
--- a/server/controllers/api/video-channel.ts
+++ b/server/controllers/api/video-channel.ts
@@ -6,7 +6,7 @@ import { ActorFollowModel } from '@server/models/actor/actor-follow'
6import { getServerActor } from '@server/models/application/application' 6import { getServerActor } from '@server/models/application/application'
7import { guessAdditionalAttributesFromQuery } from '@server/models/video/formatter/video-format-utils' 7import { guessAdditionalAttributesFromQuery } from '@server/models/video/formatter/video-format-utils'
8import { MChannelBannerAccountDefault } from '@server/types/models' 8import { MChannelBannerAccountDefault } from '@server/types/models'
9import { ActorImageType, HttpStatusCode, VideoChannelCreate, VideoChannelUpdate } from '@shared/models' 9import { ActorImageType, HttpStatusCode, VideoChannelCreate, VideoChannelUpdate, VideosImportInChannelCreate } from '@shared/models'
10import { auditLoggerFactory, getAuditIdFromRes, VideoChannelAuditView } from '../../helpers/audit-logger' 10import { auditLoggerFactory, getAuditIdFromRes, VideoChannelAuditView } from '../../helpers/audit-logger'
11import { resetSequelizeInstance } from '../../helpers/database-utils' 11import { resetSequelizeInstance } from '../../helpers/database-utils'
12import { buildNSFWFilter, createReqFiles, getCountVideos, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils' 12import { buildNSFWFilter, createReqFiles, getCountVideos, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils'
@@ -166,7 +166,7 @@ videoChannelRouter.get('/:nameWithHost/followers',
166videoChannelRouter.post('/:nameWithHost/import-videos', 166videoChannelRouter.post('/:nameWithHost/import-videos',
167 authenticate, 167 authenticate,
168 asyncMiddleware(videoChannelsNameWithHostValidator), 168 asyncMiddleware(videoChannelsNameWithHostValidator),
169 videoChannelImportVideosValidator, 169 asyncMiddleware(videoChannelImportVideosValidator),
170 ensureIsLocalChannel, 170 ensureIsLocalChannel,
171 ensureCanManageChannel, 171 ensureCanManageChannel,
172 asyncMiddleware(ensureChannelOwnerCanUpload), 172 asyncMiddleware(ensureChannelOwnerCanUpload),
@@ -418,13 +418,14 @@ async function listVideoChannelFollowers (req: express.Request, res: express.Res
418} 418}
419 419
420async function importVideosInChannel (req: express.Request, res: express.Response) { 420async function importVideosInChannel (req: express.Request, res: express.Response) {
421 const { externalChannelUrl } = req.body 421 const { externalChannelUrl } = req.body as VideosImportInChannelCreate
422 422
423 await JobQueue.Instance.createJob({ 423 await JobQueue.Instance.createJob({
424 type: 'video-channel-import', 424 type: 'video-channel-import',
425 payload: { 425 payload: {
426 externalChannelUrl, 426 externalChannelUrl,
427 videoChannelId: res.locals.videoChannel.id 427 videoChannelId: res.locals.videoChannel.id,
428 partOfChannelSyncId: res.locals.videoChannelSync?.id
428 } 429 }
429 }) 430 })
430 431