fix validation misconfiguration
This commit is contained in:
parent
8f7cac2242
commit
a1d42ac398
2 changed files with 5 additions and 2 deletions
|
|
@ -45,7 +45,7 @@ export const createOrderValidator = [
|
||||||
.isString()
|
.isString()
|
||||||
.matches(NON_NEGATIVE_REAL_NUMBER_REGEX)
|
.matches(NON_NEGATIVE_REAL_NUMBER_REGEX)
|
||||||
.withMessage('orderData.amount must be a positive decimal string'),
|
.withMessage('orderData.amount must be a positive decimal string'),
|
||||||
body('orderData.pairId').isString().withMessage('orderData.pairId must be a string'),
|
body('orderData.pairId').isNumeric().withMessage('orderData.pairId must be a number'),
|
||||||
];
|
];
|
||||||
|
|
||||||
export default CreateOrderBody;
|
export default CreateOrderBody;
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,10 @@ class Middleware {
|
||||||
if (!errors.isEmpty()) {
|
if (!errors.isEmpty()) {
|
||||||
res.status(500).send({
|
res.status(500).send({
|
||||||
success: false,
|
success: false,
|
||||||
data: 'Internal error',
|
data: errors
|
||||||
|
.array()
|
||||||
|
.map((err) => err.msg)
|
||||||
|
.join(', '),
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue