Add user limit check for free plan

This commit is contained in:
Simon Larsen
2023-12-20 11:54:26 +00:00
parent b483cf1601
commit fdff20a2f9
2 changed files with 9 additions and 1 deletions

View File

@@ -16,7 +16,7 @@ import { IsBillingEnabled } from '../EnvironmentConfig';
import { AccountsRoute } from 'Common/ServiceRoute';
import DatabaseConfig from '../DatabaseConfig';
import BillingService from './BillingService';
import SubscriptionPlan from 'Common/Types/Billing/SubscriptionPlan';
import SubscriptionPlan, { PlanSelect } from 'Common/Types/Billing/SubscriptionPlan';
import Project from 'Model/Models/Project';
import MailService from './MailService';
import EmailTemplateType from 'Common/Types/Email/EmailTemplateType';
@@ -62,6 +62,13 @@ export class TeamMemberService extends DatabaseService<TeamMember> {
Errors.TeamMemberService.LIMIT_REACHED
);
}
if(createBy.props.currentPlan === PlanSelect.Free && project && project.paymentProviderSubscriptionSeats && project.paymentProviderSubscriptionSeats >= 1){
throw new BadDataException(
Errors.TeamMemberService.LIMIT_REACHED_FOR_FREE_PLAN
);
}
}
createBy.data.hasAcceptedInvitation = false;

View File

@@ -19,5 +19,6 @@ export default {
'This team should have at least 1 member who has accepted the invitation.',
LIMIT_REACHED:
'You have reached the user limit. You cannot invite any more users to this project. Please contact billing@oneuptime.com to increase your user limit.',
LIMIT_REACHED_FOR_FREE_PLAN: 'You have reached the user limit for the free plan. Please upgrade your plan to Growth to invite more users.',
},
};