feat: fix customer creation

This commit is contained in:
Nevo David 2024-03-11 01:11:29 +07:00
parent 95d7cfd3e6
commit b06585879b
1 changed files with 6 additions and 4 deletions

View File

@ -48,6 +48,8 @@ export class SubscriptionService {
totalChannels: number,
billing: 'FREE' | 'STANDARD' | 'PRO'
) {
const getOrgByCustomerId = await this._subscriptionRepository.getOrganizationByCustomerId(customerId);
const getCurrentSubscription =
(await this._subscriptionRepository.getSubscriptionByCustomerId(
customerId
@ -57,27 +59,27 @@ export class SubscriptionService {
const currentTotalChannels = (
await this._integrationService.getIntegrationsList(
getCurrentSubscription.organizationId
getOrgByCustomerId?.id!
)
).filter((f) => !f.disabled);
if (currentTotalChannels.length > totalChannels) {
await this._integrationService.disableIntegrations(
getCurrentSubscription.organizationId,
getOrgByCustomerId?.id!,
currentTotalChannels.length - totalChannels
);
}
if (from.team_members && !to.team_members) {
await this._organizationService.disableOrEnableNonSuperAdminUsers(
getCurrentSubscription.organizationId,
getOrgByCustomerId?.id!,
true
);
}
if (!from.team_members && to.team_members) {
await this._organizationService.disableOrEnableNonSuperAdminUsers(
getCurrentSubscription.organizationId,
getOrgByCustomerId?.id!,
false
);
}