-import express = require('express')
+import * as express from 'express'
import { waterfall } from 'async'
import { database as db } from '../../initializers/database'
setBodyHostPort,
setBodyHostsPort
} from '../../middlewares'
+import {
+ PodInstance
+} from '../../models'
const podsRouter = express.Router()
// ---------------------------------------------------------------------------
-function addPods (req, res, next) {
+function addPods (req: express.Request, res: express.Response, next: express.NextFunction) {
const informations = req.body
- waterfall([
+ waterfall<string, Error>([
function addPod (callback) {
const pod = db.Pod.build(informations)
pod.save().asCallback(function (err, podCreated) {
})
},
- function sendMyVideos (podCreated, callback) {
+ function sendMyVideos (podCreated: PodInstance, callback) {
sendOwnedVideosToPod(podCreated.id)
callback(null)
})
}
-function listPods (req, res, next) {
+function listPods (req: express.Request, res: express.Response, next: express.NextFunction) {
db.Pod.list(function (err, podsList) {
if (err) return next(err)
})
}
-function makeFriendsController (req, res, next) {
- const hosts = req.body.hosts
+function makeFriendsController (req: express.Request, res: express.Response, next: express.NextFunction) {
+ const hosts = req.body.hosts as string[]
makeFriends(hosts, function (err) {
if (err) {
res.type('json').status(204).end()
}
-function quitFriendsController (req, res, next) {
+function quitFriendsController (req: express.Request, res: express.Response, next: express.NextFunction) {
quitFriends(function (err) {
if (err) return next(err)