mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-14 20:00:33 +00:00
fix: subscription middleare
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
import { Container } from 'typedi';
|
||||
import { Request, Response, NextFunction } from 'express';
|
||||
|
||||
const SupportedMethods = ['POST', 'PUT'];
|
||||
const Excluded = [];
|
||||
|
||||
export default (subscriptionSlug = 'main') =>
|
||||
async (req: Request, res: Response, next: NextFunction) => {
|
||||
const { tenant, tenantId } = req;
|
||||
@@ -19,8 +22,7 @@ export default (subscriptionSlug = 'main') =>
|
||||
errors: [{ type: 'TENANT.HAS.NO.SUBSCRIPTION' }],
|
||||
});
|
||||
}
|
||||
// Validate in case the subscription is inactive.
|
||||
else if (subscription.inactive()) {
|
||||
if (SupportedMethods.includes(req.method) && subscription.inactive()) {
|
||||
return res.boom.badRequest(null, {
|
||||
errors: [{ type: 'ORGANIZATION.SUBSCRIPTION.INACTIVE' }],
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user