aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/api')
-rw-r--r--server/controllers/api/index.ts4
-rw-r--r--server/controllers/api/server/follows.ts20
-rw-r--r--server/controllers/api/server/index.ts8
3 files changed, 16 insertions, 16 deletions
diff --git a/server/controllers/api/index.ts b/server/controllers/api/index.ts
index 876c911c7..b00fb7467 100644
--- a/server/controllers/api/index.ts
+++ b/server/controllers/api/index.ts
@@ -4,13 +4,13 @@ import { badRequest } from '../../helpers'
4 4
5import { oauthClientsRouter } from './oauth-clients' 5import { oauthClientsRouter } from './oauth-clients'
6import { configRouter } from './config' 6import { configRouter } from './config'
7import { applicationRouter } from './server' 7import { serverRouter } from './server'
8import { usersRouter } from './users' 8import { usersRouter } from './users'
9import { videosRouter } from './videos' 9import { videosRouter } from './videos'
10 10
11const apiRouter = express.Router() 11const apiRouter = express.Router()
12 12
13apiRouter.use('/application', applicationRouter) 13apiRouter.use('/server', serverRouter)
14apiRouter.use('/oauth-clients', oauthClientsRouter) 14apiRouter.use('/oauth-clients', oauthClientsRouter)
15apiRouter.use('/config', configRouter) 15apiRouter.use('/config', configRouter)
16apiRouter.use('/users', usersRouter) 16apiRouter.use('/users', usersRouter)
diff --git a/server/controllers/api/server/follows.ts b/server/controllers/api/server/follows.ts
index e00787f02..520d4d858 100644
--- a/server/controllers/api/server/follows.ts
+++ b/server/controllers/api/server/follows.ts
@@ -15,9 +15,9 @@ import { ensureUserHasRight } from '../../../middlewares/user-right'
15import { followValidator } from '../../../middlewares/validators/servers' 15import { followValidator } from '../../../middlewares/validators/servers'
16import { followersSortValidator, followingSortValidator } from '../../../middlewares/validators/sort' 16import { followersSortValidator, followingSortValidator } from '../../../middlewares/validators/sort'
17 17
18const applicationFollowsRouter = express.Router() 18const serverFollowsRouter = express.Router()
19 19
20applicationFollowsRouter.get('/following', 20serverFollowsRouter.get('/following',
21 paginationValidator, 21 paginationValidator,
22 followingSortValidator, 22 followingSortValidator,
23 setFollowingSort, 23 setFollowingSort,
@@ -25,15 +25,15 @@ applicationFollowsRouter.get('/following',
25 asyncMiddleware(listFollowing) 25 asyncMiddleware(listFollowing)
26) 26)
27 27
28applicationFollowsRouter.post('/follow', 28serverFollowsRouter.post('/follow',
29 authenticate, 29 authenticate,
30 ensureUserHasRight(UserRight.MANAGE_APPLICATION_FOLLOW), 30 ensureUserHasRight(UserRight.MANAGE_SERVER_FOLLOW),
31 followValidator, 31 followValidator,
32 setBodyHostsPort, 32 setBodyHostsPort,
33 asyncMiddleware(follow) 33 asyncMiddleware(follow)
34) 34)
35 35
36applicationFollowsRouter.get('/followers', 36serverFollowsRouter.get('/followers',
37 paginationValidator, 37 paginationValidator,
38 followersSortValidator, 38 followersSortValidator,
39 setFollowersSort, 39 setFollowersSort,
@@ -44,21 +44,21 @@ applicationFollowsRouter.get('/followers',
44// --------------------------------------------------------------------------- 44// ---------------------------------------------------------------------------
45 45
46export { 46export {
47 applicationFollowsRouter 47 serverFollowsRouter
48} 48}
49 49
50// --------------------------------------------------------------------------- 50// ---------------------------------------------------------------------------
51 51
52async function listFollowing (req: express.Request, res: express.Response, next: express.NextFunction) { 52async function listFollowing (req: express.Request, res: express.Response, next: express.NextFunction) {
53 const applicationAccount = await getServerAccount() 53 const serverAccount = await getServerAccount()
54 const resultList = await db.AccountFollow.listFollowingForApi(applicationAccount.id, req.query.start, req.query.count, req.query.sort) 54 const resultList = await db.AccountFollow.listFollowingForApi(serverAccount.id, req.query.start, req.query.count, req.query.sort)
55 55
56 return res.json(getFormattedObjects(resultList.data, resultList.total)) 56 return res.json(getFormattedObjects(resultList.data, resultList.total))
57} 57}
58 58
59async function listFollowers (req: express.Request, res: express.Response, next: express.NextFunction) { 59async function listFollowers (req: express.Request, res: express.Response, next: express.NextFunction) {
60 const applicationAccount = await getServerAccount() 60 const serverAccount = await getServerAccount()
61 const resultList = await db.AccountFollow.listFollowersForApi(applicationAccount.id, req.query.start, req.query.count, req.query.sort) 61 const resultList = await db.AccountFollow.listFollowersForApi(serverAccount.id, req.query.start, req.query.count, req.query.sort)
62 62
63 return res.json(getFormattedObjects(resultList.data, resultList.total)) 63 return res.json(getFormattedObjects(resultList.data, resultList.total))
64} 64}
diff --git a/server/controllers/api/server/index.ts b/server/controllers/api/server/index.ts
index 011b971ed..8dc1a0031 100644
--- a/server/controllers/api/server/index.ts
+++ b/server/controllers/api/server/index.ts
@@ -1,12 +1,12 @@
1import * as express from 'express' 1import * as express from 'express'
2import { applicationFollowsRouter } from './follows' 2import { serverFollowsRouter } from './follows'
3 3
4const applicationRouter = express.Router() 4const serverRouter = express.Router()
5 5
6applicationRouter.use('/', applicationFollowsRouter) 6serverRouter.use('/', serverFollowsRouter)
7 7
8// --------------------------------------------------------------------------- 8// ---------------------------------------------------------------------------
9 9
10export { 10export {
11 applicationRouter 11 serverRouter
12} 12}