aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/accounts.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/api/accounts.ts')
-rw-r--r--server/controllers/api/accounts.ts28
1 files changed, 28 insertions, 0 deletions
diff --git a/server/controllers/api/accounts.ts b/server/controllers/api/accounts.ts
index 66cdaab82..7a530cde5 100644
--- a/server/controllers/api/accounts.ts
+++ b/server/controllers/api/accounts.ts
@@ -25,8 +25,10 @@ import {
25 accountsFollowersSortValidator, 25 accountsFollowersSortValidator,
26 accountsSortValidator, 26 accountsSortValidator,
27 ensureAuthUserOwnsAccountValidator, 27 ensureAuthUserOwnsAccountValidator,
28 ensureCanManageUser,
28 videoChannelsSortValidator, 29 videoChannelsSortValidator,
29 videoChannelStatsValidator, 30 videoChannelStatsValidator,
31 videoChannelSyncsSortValidator,
30 videosSortValidator 32 videosSortValidator
31} from '../../middlewares/validators' 33} from '../../middlewares/validators'
32import { commonVideoPlaylistFiltersValidator, videoPlaylistsSearchValidator } from '../../middlewares/validators/videos/video-playlists' 34import { commonVideoPlaylistFiltersValidator, videoPlaylistsSearchValidator } from '../../middlewares/validators/videos/video-playlists'
@@ -35,6 +37,7 @@ import { AccountVideoRateModel } from '../../models/account/account-video-rate'
35import { VideoModel } from '../../models/video/video' 37import { VideoModel } from '../../models/video/video'
36import { VideoChannelModel } from '../../models/video/video-channel' 38import { VideoChannelModel } from '../../models/video/video-channel'
37import { VideoPlaylistModel } from '../../models/video/video-playlist' 39import { VideoPlaylistModel } from '../../models/video/video-playlist'
40import { VideoChannelSyncModel } from '@server/models/video/video-channel-sync'
38 41
39const accountsRouter = express.Router() 42const accountsRouter = express.Router()
40 43
@@ -72,6 +75,17 @@ accountsRouter.get('/:accountName/video-channels',
72 asyncMiddleware(listAccountChannels) 75 asyncMiddleware(listAccountChannels)
73) 76)
74 77
78accountsRouter.get('/:accountName/video-channel-syncs',
79 authenticate,
80 asyncMiddleware(accountNameWithHostGetValidator),
81 ensureCanManageUser,
82 paginationValidator,
83 videoChannelSyncsSortValidator,
84 setDefaultSort,
85 setDefaultPagination,
86 asyncMiddleware(listAccountChannelsSync)
87)
88
75accountsRouter.get('/:accountName/video-playlists', 89accountsRouter.get('/:accountName/video-playlists',
76 optionalAuthenticate, 90 optionalAuthenticate,
77 asyncMiddleware(accountNameWithHostGetValidator), 91 asyncMiddleware(accountNameWithHostGetValidator),
@@ -146,6 +160,20 @@ async function listAccountChannels (req: express.Request, res: express.Response)
146 return res.json(getFormattedObjects(resultList.data, resultList.total)) 160 return res.json(getFormattedObjects(resultList.data, resultList.total))
147} 161}
148 162
163async function listAccountChannelsSync (req: express.Request, res: express.Response) {
164 const options = {
165 accountId: res.locals.account.id,
166 start: req.query.start,
167 count: req.query.count,
168 sort: req.query.sort,
169 search: req.query.search
170 }
171
172 const resultList = await VideoChannelSyncModel.listByAccountForAPI(options)
173
174 return res.json(getFormattedObjects(resultList.data, resultList.total))
175}
176
149async function listAccountPlaylists (req: express.Request, res: express.Response) { 177async function listAccountPlaylists (req: express.Request, res: express.Response) {
150 const serverActor = await getServerActor() 178 const serverActor = await getServerActor()
151 179