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.ts17
1 files changed, 10 insertions, 7 deletions
diff --git a/server/controllers/api/pods.ts b/server/controllers/api/pods.ts
index a028c4ab9..283105f6c 100644
--- a/server/controllers/api/pods.ts
+++ b/server/controllers/api/pods.ts
@@ -21,6 +21,9 @@ import {
21 setBodyHostPort, 21 setBodyHostPort,
22 setBodyHostsPort 22 setBodyHostsPort
23} from '../../middlewares' 23} from '../../middlewares'
24import {
25 PodInstance
26} from '../../models'
24 27
25const podsRouter = express.Router() 28const podsRouter = express.Router()
26 29
@@ -51,10 +54,10 @@ export {
51 54
52// --------------------------------------------------------------------------- 55// ---------------------------------------------------------------------------
53 56
54function addPods (req, res, next) { 57function addPods (req: express.Request, res: express.Response, next: express.NextFunction) {
55 const informations = req.body 58 const informations = req.body
56 59
57 waterfall([ 60 waterfall<string, Error>([
58 function addPod (callback) { 61 function addPod (callback) {
59 const pod = db.Pod.build(informations) 62 const pod = db.Pod.build(informations)
60 pod.save().asCallback(function (err, podCreated) { 63 pod.save().asCallback(function (err, podCreated) {
@@ -63,7 +66,7 @@ function addPods (req, res, next) {
63 }) 66 })
64 }, 67 },
65 68
66 function sendMyVideos (podCreated, callback) { 69 function sendMyVideos (podCreated: PodInstance, callback) {
67 sendOwnedVideosToPod(podCreated.id) 70 sendOwnedVideosToPod(podCreated.id)
68 71
69 callback(null) 72 callback(null)
@@ -86,7 +89,7 @@ function addPods (req, res, next) {
86 }) 89 })
87} 90}
88 91
89function listPods (req, res, next) { 92function listPods (req: express.Request, res: express.Response, next: express.NextFunction) {
90 db.Pod.list(function (err, podsList) { 93 db.Pod.list(function (err, podsList) {
91 if (err) return next(err) 94 if (err) return next(err)
92 95
@@ -94,8 +97,8 @@ function listPods (req, res, next) {
94 }) 97 })
95} 98}
96 99
97function makeFriendsController (req, res, next) { 100function makeFriendsController (req: express.Request, res: express.Response, next: express.NextFunction) {
98 const hosts = req.body.hosts 101 const hosts = req.body.hosts as string[]
99 102
100 makeFriends(hosts, function (err) { 103 makeFriends(hosts, function (err) {
101 if (err) { 104 if (err) {
@@ -109,7 +112,7 @@ function makeFriendsController (req, res, next) {
109 res.type('json').status(204).end() 112 res.type('json').status(204).end()
110} 113}
111 114
112function quitFriendsController (req, res, next) { 115function quitFriendsController (req: express.Request, res: express.Response, next: express.NextFunction) {
113 quitFriends(function (err) { 116 quitFriends(function (err) {
114 if (err) return next(err) 117 if (err) return next(err)
115 118