aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/follows.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2017-12-12 17:53:50 +0100
committerChocobozzz <me@florianbigard.com>2017-12-13 16:50:33 +0100
commit3fd3ab2d34d512b160a5e6084d7609be7b4f4452 (patch)
treee5ca358287fca6ecacce83defcf23af1e8e9f419 /server/middlewares/validators/follows.ts
parentc893d4514e6ecbf282c7985fe5f82b8acd8a1137 (diff)
downloadPeerTube-3fd3ab2d34d512b160a5e6084d7609be7b4f4452.tar.gz
PeerTube-3fd3ab2d34d512b160a5e6084d7609be7b4f4452.tar.zst
PeerTube-3fd3ab2d34d512b160a5e6084d7609be7b4f4452.zip
Move models to typescript-sequelize
Diffstat (limited to 'server/middlewares/validators/follows.ts')
-rw-r--r--server/middlewares/validators/follows.ts11
1 files changed, 5 insertions, 6 deletions
diff --git a/server/middlewares/validators/follows.ts b/server/middlewares/validators/follows.ts
index 605872ecf..10482e5d0 100644
--- a/server/middlewares/validators/follows.ts
+++ b/server/middlewares/validators/follows.ts
@@ -1,12 +1,11 @@
1import * as express from 'express' 1import * as express from 'express'
2import { body, param } from 'express-validator/check' 2import { body, param } from 'express-validator/check'
3import { isTestInstance } from '../../helpers/core-utils' 3import { getServerAccount, isTestInstance, logger } from '../../helpers'
4import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc'
4import { isEachUniqueHostValid } from '../../helpers/custom-validators/servers' 5import { isEachUniqueHostValid } from '../../helpers/custom-validators/servers'
5import { logger } from '../../helpers/logger' 6import { CONFIG } from '../../initializers'
6import { CONFIG, database as db } from '../../initializers' 7import { AccountFollowModel } from '../../models/account/account-follow'
7import { areValidationErrors } from './utils' 8import { areValidationErrors } from './utils'
8import { getServerAccount } from '../../helpers/utils'
9import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc'
10 9
11const followValidator = [ 10const followValidator = [
12 body('hosts').custom(isEachUniqueHostValid).withMessage('Should have an array of unique hosts'), 11 body('hosts').custom(isEachUniqueHostValid).withMessage('Should have an array of unique hosts'),
@@ -38,7 +37,7 @@ const removeFollowingValidator = [
38 if (areValidationErrors(req, res)) return 37 if (areValidationErrors(req, res)) return
39 38
40 const serverAccount = await getServerAccount() 39 const serverAccount = await getServerAccount()
41 const follow = await db.AccountFollow.loadByAccountAndTarget(serverAccount.id, req.params.accountId) 40 const follow = await AccountFollowModel.loadByAccountAndTarget(serverAccount.id, req.params.accountId)
42 41
43 if (!follow) { 42 if (!follow) {
44 return res.status(404) 43 return res.status(404)