aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/middlewares/accounts.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers/middlewares/accounts.ts')
-rw-r--r--server/helpers/middlewares/accounts.ts7
1 files changed, 5 insertions, 2 deletions
diff --git a/server/helpers/middlewares/accounts.ts b/server/helpers/middlewares/accounts.ts
index 791022b97..f5aa0bada 100644
--- a/server/helpers/middlewares/accounts.ts
+++ b/server/helpers/middlewares/accounts.ts
@@ -1,6 +1,7 @@
1import { Response } from 'express' 1import { Response } from 'express'
2import { AccountModel } from '../../models/account/account' 2import { AccountModel } from '../../models/account/account'
3import * as Bluebird from 'bluebird' 3import * as Bluebird from 'bluebird'
4import { MAccountDefault } from '../../typings/models'
4 5
5function doesAccountIdExist (id: number, res: Response, sendNotFound = true) { 6function doesAccountIdExist (id: number, res: Response, sendNotFound = true) {
6 const promise = AccountModel.load(id) 7 const promise = AccountModel.load(id)
@@ -15,10 +16,12 @@ function doesLocalAccountNameExist (name: string, res: Response, sendNotFound =
15} 16}
16 17
17function doesAccountNameWithHostExist (nameWithDomain: string, res: Response, sendNotFound = true) { 18function doesAccountNameWithHostExist (nameWithDomain: string, res: Response, sendNotFound = true) {
18 return doesAccountExist(AccountModel.loadByNameWithHost(nameWithDomain), res, sendNotFound) 19 const promise = AccountModel.loadByNameWithHost(nameWithDomain)
20
21 return doesAccountExist(promise, res, sendNotFound)
19} 22}
20 23
21async function doesAccountExist (p: Bluebird<AccountModel>, res: Response, sendNotFound: boolean) { 24async function doesAccountExist (p: Bluebird<MAccountDefault>, res: Response, sendNotFound: boolean) {
22 const account = await p 25 const account = await p
23 26
24 if (!account) { 27 if (!account) {