aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/api')
-rw-r--r--server/controllers/api/users.ts8
-rw-r--r--server/controllers/api/videos/channel.ts20
-rw-r--r--server/controllers/api/videos/index.ts2
3 files changed, 15 insertions, 15 deletions
diff --git a/server/controllers/api/users.ts b/server/controllers/api/users.ts
index bacfc4552..9ec6feb57 100644
--- a/server/controllers/api/users.ts
+++ b/server/controllers/api/users.ts
@@ -28,7 +28,7 @@ import {
28 UserRole, 28 UserRole,
29 UserRight 29 UserRight
30} from '../../../shared' 30} from '../../../shared'
31import { createUserAuthorAndChannel } from '../../lib' 31import { createUserAccountAndChannel } from '../../lib'
32import { UserInstance } from '../../models' 32import { UserInstance } from '../../models'
33import { videosSortValidator } from '../../middlewares/validators/sort' 33import { videosSortValidator } from '../../middlewares/validators/sort'
34import { setVideosSort } from '../../middlewares/sort' 34import { setVideosSort } from '../../middlewares/sort'
@@ -142,9 +142,9 @@ async function createUser (req: express.Request, res: express.Response, next: ex
142 videoQuota: body.videoQuota 142 videoQuota: body.videoQuota
143 }) 143 })
144 144
145 await createUserAuthorAndChannel(user) 145 await createUserAccountAndChannel(user)
146 146
147 logger.info('User %s with its channel and author created.', body.username) 147 logger.info('User %s with its channel and account created.', body.username)
148} 148}
149 149
150async function registerUser (req: express.Request, res: express.Response, next: express.NextFunction) { 150async function registerUser (req: express.Request, res: express.Response, next: express.NextFunction) {
@@ -159,7 +159,7 @@ async function registerUser (req: express.Request, res: express.Response, next:
159 videoQuota: CONFIG.USER.VIDEO_QUOTA 159 videoQuota: CONFIG.USER.VIDEO_QUOTA
160 }) 160 })
161 161
162 await createUserAuthorAndChannel(user) 162 await createUserAccountAndChannel(user)
163 return res.type('json').status(204).end() 163 return res.type('json').status(204).end()
164} 164}
165 165
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}
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts
index 964db151d..9ad84609f 100644
--- a/server/controllers/api/videos/index.ts
+++ b/server/controllers/api/videos/index.ts
@@ -395,7 +395,7 @@ async function removeVideo (req: express.Request, res: express.Response) {
395} 395}
396 396
397async function searchVideos (req: express.Request, res: express.Response, next: express.NextFunction) { 397async function searchVideos (req: express.Request, res: express.Response, next: express.NextFunction) {
398 const resultList = await db.Video.searchAndPopulateAuthorAndPodAndTags( 398 const resultList = await db.Video.searchAndPopulateAccountAndPodAndTags(
399 req.params.value, 399 req.params.value,
400 req.query.field, 400 req.query.field,
401 req.query.start, 401 req.query.start,