feat(invoices|receipts|estimates|payments): auto-increment backend logic based.

This commit is contained in:
a.bouhuolia
2021-03-07 16:14:59 +02:00
parent c245f4249d
commit 42ce791713
17 changed files with 482 additions and 201 deletions

View File

@@ -101,7 +101,7 @@ export default class SalesEstimatesController extends BaseController {
check('estimate_date').exists().isISO8601(),
check('expiration_date').optional().isISO8601(),
check('reference').optional(),
check('estimate_number').exists().trim().escape(),
check('estimate_number').optional().trim().escape(),
check('delivered').default(false).isBoolean().toBoolean(),
check('entries').exists().isArray({ min: 1 }),
@@ -401,6 +401,11 @@ export default class SalesEstimatesController extends BaseController {
errors: [{ type: 'CUSTOMER_NOT_FOUND', code: 1300 }],
});
}
if (error.errorType === 'SALE_ESTIMATE_NO_IS_REQUIRED') {
return res.boom.badRequest(null, {
errors: [{ type: 'SALE_ESTIMATE_NO_IS_REQUIRED', code: 1400 }],
});
}
}
next(error);
}