-function checkLocalAccountExists (nameWithHost: string, res: express.Response, callback: (err: Error, account: AccountInstance) => void) {
- const [ name, host ] = nameWithHost.split('@')
-
- db.Account.loadLocalAccountByNameAndPod(name, host)
- .then(account => {
- if (!account) {
- return res.status(404)
- .send({ error: 'Account not found' })
- .end()
- }
-
- res.locals.account = account
- return callback(null, account)
- })
- .catch(err => {
- logger.error('Error in account request validator.', err)
- return res.sendStatus(500)
- })