diff options
author | Chocobozzz <me@florianbigard.com> | 2017-12-12 17:53:50 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2017-12-13 16:50:33 +0100 |
commit | 3fd3ab2d34d512b160a5e6084d7609be7b4f4452 (patch) | |
tree | e5ca358287fca6ecacce83defcf23af1e8e9f419 /server/middlewares/validators/follows.ts | |
parent | c893d4514e6ecbf282c7985fe5f82b8acd8a1137 (diff) | |
download | PeerTube-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.ts | 11 |
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 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { body, param } from 'express-validator/check' | 2 | import { body, param } from 'express-validator/check' |
3 | import { isTestInstance } from '../../helpers/core-utils' | 3 | import { getServerAccount, isTestInstance, logger } from '../../helpers' |
4 | import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc' | ||
4 | import { isEachUniqueHostValid } from '../../helpers/custom-validators/servers' | 5 | import { isEachUniqueHostValid } from '../../helpers/custom-validators/servers' |
5 | import { logger } from '../../helpers/logger' | 6 | import { CONFIG } from '../../initializers' |
6 | import { CONFIG, database as db } from '../../initializers' | 7 | import { AccountFollowModel } from '../../models/account/account-follow' |
7 | import { areValidationErrors } from './utils' | 8 | import { areValidationErrors } from './utils' |
8 | import { getServerAccount } from '../../helpers/utils' | ||
9 | import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc' | ||
10 | 9 | ||
11 | const followValidator = [ | 10 | const 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) |