]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/middlewares/validators/pods.ts
Fix test (#71)
[github/Chocobozzz/PeerTube.git] / server / middlewares / validators / pods.ts
index fbfd268d05e1d9a2b572cb072a2ccf4d8751dfdf..d8eb90168a1c1014453461fc1d0d25fe80683432 100644 (file)
@@ -1,11 +1,14 @@
-const db = require('../../initializers/database')
+import 'express-validator'
+import * as express from 'express'
+
+import { database as db } from '../../initializers/database'
 import { checkErrors } from './utils'
 import { logger } from '../../helpers'
 import { CONFIG } from '../../initializers'
 import { hasFriends } from '../../lib'
 import { isTestInstance } from '../../helpers'
 
-function makeFriendsValidator (req, res, next) {
+function makeFriendsValidator (req: express.Request, res: express.Response, next: express.NextFunction) {
   // Force https if the administrator wants to make friends
   if (isTestInstance() === false && CONFIG.WEBSERVER.SCHEME === 'http') {
     return res.status(400).send('Cannot make friends with a non HTTPS webserver.')
@@ -32,7 +35,7 @@ function makeFriendsValidator (req, res, next) {
   })
 }
 
-function podsAddValidator (req, res, next) {
+function podsAddValidator (req: express.Request, res: express.Response, next: express.NextFunction) {
   req.checkBody('host', 'Should have a host').isHostValid()
   req.checkBody('email', 'Should have an email').isEmail()
   req.checkBody('publicKey', 'Should have a public key').notEmpty()