aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/pods.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/api/pods.ts')
-rw-r--r--server/controllers/api/pods.ts20
1 files changed, 18 insertions, 2 deletions
diff --git a/server/controllers/api/pods.ts b/server/controllers/api/pods.ts
index 5210f9fe4..916b131d9 100644
--- a/server/controllers/api/pods.ts
+++ b/server/controllers/api/pods.ts
@@ -10,7 +10,8 @@ import {
10import { 10import {
11 sendOwnedVideosToPod, 11 sendOwnedVideosToPod,
12 makeFriends, 12 makeFriends,
13 quitFriends 13 quitFriends,
14 removeFriend
14} from '../../lib' 15} from '../../lib'
15import { 16import {
16 podsAddValidator, 17 podsAddValidator,
@@ -18,7 +19,8 @@ import {
18 ensureIsAdmin, 19 ensureIsAdmin,
19 makeFriendsValidator, 20 makeFriendsValidator,
20 setBodyHostPort, 21 setBodyHostPort,
21 setBodyHostsPort 22 setBodyHostsPort,
23 podRemoveValidator
22} from '../../middlewares' 24} from '../../middlewares'
23import { 25import {
24 PodInstance 26 PodInstance
@@ -45,6 +47,12 @@ podsRouter.get('/quitfriends',
45 ensureIsAdmin, 47 ensureIsAdmin,
46 quitFriendsController 48 quitFriendsController
47) 49)
50podsRouter.delete('/:id',
51 authenticate,
52 ensureIsAdmin,
53 podRemoveValidator,
54 removeFriendController
55)
48 56
49// --------------------------------------------------------------------------- 57// ---------------------------------------------------------------------------
50 58
@@ -93,3 +101,11 @@ function quitFriendsController (req: express.Request, res: express.Response, nex
93 .then(() => res.type('json').status(204).end()) 101 .then(() => res.type('json').status(204).end())
94 .catch(err => next(err)) 102 .catch(err => next(err))
95} 103}
104
105function removeFriendController (req: express.Request, res: express.Response, next: express.NextFunction) {
106 const pod = res.locals.pod as PodInstance
107
108 removeFriend(pod)
109 .then(() => (res.type('json').status(204).end()))
110 .catch(err => next(err))
111}