aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/videos/channel.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/api/videos/channel.ts')
-rw-r--r--server/controllers/api/videos/channel.ts20
1 files changed, 10 insertions, 10 deletions
diff --git a/server/controllers/api/videos/channel.ts b/server/controllers/api/videos/channel.ts
index ab54eedee..4d1f03903 100644
--- a/server/controllers/api/videos/channel.ts
+++ b/server/controllers/api/videos/channel.ts
@@ -17,14 +17,14 @@ import {
17 videoChannelsRemoveValidator, 17 videoChannelsRemoveValidator,
18 videoChannelGetValidator, 18 videoChannelGetValidator,
19 videoChannelsUpdateValidator, 19 videoChannelsUpdateValidator,
20 listVideoAuthorChannelsValidator, 20 listVideoAccountChannelsValidator,
21 asyncMiddleware 21 asyncMiddleware
22} from '../../../middlewares' 22} from '../../../middlewares'
23import { 23import {
24 createVideoChannel, 24 createVideoChannel,
25 updateVideoChannelToFriends 25 updateVideoChannelToFriends
26} from '../../../lib' 26} from '../../../lib'
27import { VideoChannelInstance, AuthorInstance } from '../../../models' 27import { VideoChannelInstance, AccountInstance } from '../../../models'
28import { VideoChannelCreate, VideoChannelUpdate } from '../../../../shared' 28import { VideoChannelCreate, VideoChannelUpdate } from '../../../../shared'
29 29
30const videoChannelRouter = express.Router() 30const videoChannelRouter = express.Router()
@@ -37,9 +37,9 @@ videoChannelRouter.get('/channels',
37 asyncMiddleware(listVideoChannels) 37 asyncMiddleware(listVideoChannels)
38) 38)
39 39
40videoChannelRouter.get('/authors/:authorId/channels', 40videoChannelRouter.get('/accounts/:accountId/channels',
41 listVideoAuthorChannelsValidator, 41 listVideoAccountChannelsValidator,
42 asyncMiddleware(listVideoAuthorChannels) 42 asyncMiddleware(listVideoAccountChannels)
43) 43)
44 44
45videoChannelRouter.post('/channels', 45videoChannelRouter.post('/channels',
@@ -79,8 +79,8 @@ async function listVideoChannels (req: express.Request, res: express.Response, n
79 return res.json(getFormattedObjects(resultList.data, resultList.total)) 79 return res.json(getFormattedObjects(resultList.data, resultList.total))
80} 80}
81 81
82async function listVideoAuthorChannels (req: express.Request, res: express.Response, next: express.NextFunction) { 82async function listVideoAccountChannels (req: express.Request, res: express.Response, next: express.NextFunction) {
83 const resultList = await db.VideoChannel.listByAuthor(res.locals.author.id) 83 const resultList = await db.VideoChannel.listByAccount(res.locals.account.id)
84 84
85 return res.json(getFormattedObjects(resultList.data, resultList.total)) 85 return res.json(getFormattedObjects(resultList.data, resultList.total))
86} 86}
@@ -101,11 +101,11 @@ async function addVideoChannelRetryWrapper (req: express.Request, res: express.R
101 101
102async function addVideoChannel (req: express.Request, res: express.Response) { 102async function addVideoChannel (req: express.Request, res: express.Response) {
103 const videoChannelInfo: VideoChannelCreate = req.body 103 const videoChannelInfo: VideoChannelCreate = req.body
104 const author: AuthorInstance = res.locals.oauth.token.User.Author 104 const account: AccountInstance = res.locals.oauth.token.User.Account
105 let videoChannelCreated: VideoChannelInstance 105 let videoChannelCreated: VideoChannelInstance
106 106
107 await db.sequelize.transaction(async t => { 107 await db.sequelize.transaction(async t => {
108 videoChannelCreated = await createVideoChannel(videoChannelInfo, author, t) 108 videoChannelCreated = await createVideoChannel(videoChannelInfo, account, t)
109 }) 109 })
110 110
111 logger.info('Video channel with uuid %s created.', videoChannelCreated.uuid) 111 logger.info('Video channel with uuid %s created.', videoChannelCreated.uuid)
@@ -179,7 +179,7 @@ async function removeVideoChannel (req: express.Request, res: express.Response)
179} 179}
180 180
181async function getVideoChannel (req: express.Request, res: express.Response, next: express.NextFunction) { 181async function getVideoChannel (req: express.Request, res: express.Response, next: express.NextFunction) {
182 const videoChannelWithVideos = await db.VideoChannel.loadAndPopulateAuthorAndVideos(res.locals.videoChannel.id) 182 const videoChannelWithVideos = await db.VideoChannel.loadAndPopulateAccountAndVideos(res.locals.videoChannel.id)
183 183
184 return res.json(videoChannelWithVideos.toFormattedJSON()) 184 return res.json(videoChannelWithVideos.toFormattedJSON())
185} 185}