fix: save payee contact to expense transaction.

This commit is contained in:
a.bouhuolia
2020-12-16 12:23:07 +02:00
parent 76488008c1
commit ddf31feb72
6 changed files with 45 additions and 14 deletions

View File

@@ -104,6 +104,7 @@ export default class ExpensesController extends BaseController {
check('currency_code').optional().isString().isLength({ max: 3 }),
check('exchange_rate').optional({ nullable: true }).isNumeric().toFloat(),
check('publish').optional().isBoolean().toBoolean(),
check('payee_id').optional({ nullable: true }).isNumeric().toInt(),
check('categories').exists().isArray({ min: 1 }),
check('categories.*.index')
@@ -392,6 +393,11 @@ export default class ExpensesController extends BaseController {
errors: [{ type: 'EXPENSE_ALREADY_PUBLISHED', code: 700 }],
});
}
if (error.errorType === 'contact_not_found') {
return res.boom.badRequest(null, {
errors: [{ type: 'CONTACT_NOT_FOUND', code: 800 }],
});
}
}
next(error);
}