diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-06-10 22:15:25 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-06-10 22:15:25 +0200 |
commit | 69818c9394366b954b6ba3bd697bd9d2b09f2a16 (patch) | |
tree | ad199a18ec3c322460d6f9523fc383ee562554e0 /server/controllers/api/pods.ts | |
parent | 4d4e5cd4dca78480ec7f40e747f424cd107376a4 (diff) | |
download | PeerTube-69818c9394366b954b6ba3bd697bd9d2b09f2a16.tar.gz PeerTube-69818c9394366b954b6ba3bd697bd9d2b09f2a16.tar.zst PeerTube-69818c9394366b954b6ba3bd697bd9d2b09f2a16.zip |
Type functions
Diffstat (limited to 'server/controllers/api/pods.ts')
-rw-r--r-- | server/controllers/api/pods.ts | 17 |
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' |
24 | import { | ||
25 | PodInstance | ||
26 | } from '../../models' | ||
24 | 27 | ||
25 | const podsRouter = express.Router() | 28 | const podsRouter = express.Router() |
26 | 29 | ||
@@ -51,10 +54,10 @@ export { | |||
51 | 54 | ||
52 | // --------------------------------------------------------------------------- | 55 | // --------------------------------------------------------------------------- |
53 | 56 | ||
54 | function addPods (req, res, next) { | 57 | function 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 | ||
89 | function listPods (req, res, next) { | 92 | function 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 | ||
97 | function makeFriendsController (req, res, next) { | 100 | function 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 | ||
112 | function quitFriendsController (req, res, next) { | 115 | function 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 | ||