-function checkLocalAccountExists (name: string, res: express.Response, callback: (err: Error, account: AccountInstance) => void) {
- db.Account.loadLocalByName(name)
- .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)
- })