feat: fix billing
This commit is contained in:
parent
a8e32dc399
commit
2ab65bb375
|
|
@ -1,5 +1,14 @@
|
|||
import {
|
||||
Body, Controller, Delete, Get, HttpException, Param, Post, Put, Query, UseFilters
|
||||
Body,
|
||||
Controller,
|
||||
Delete,
|
||||
Get,
|
||||
HttpException,
|
||||
Param,
|
||||
Post,
|
||||
Put,
|
||||
Query,
|
||||
UseFilters,
|
||||
} from '@nestjs/common';
|
||||
import { ioRedis } from '@gitroom/nestjs-libraries/redis/redis.service';
|
||||
import { ConnectIntegrationDto } from '@gitroom/nestjs-libraries/dtos/integrations/connect.integration.dto';
|
||||
|
|
@ -483,7 +492,7 @@ export class IntegrationsController {
|
|||
if (
|
||||
process.env.STRIPE_PUBLISHABLE_KEY &&
|
||||
org.isTrailing &&
|
||||
!!(await this._integrationService.checkPreviousConnections(
|
||||
(await this._integrationService.checkPreviousConnections(
|
||||
org.id,
|
||||
String(id)
|
||||
))
|
||||
|
|
|
|||
|
|
@ -69,16 +69,17 @@ export class IntegrationRepository {
|
|||
}
|
||||
|
||||
async checkPreviousConnections(org: string, id: string) {
|
||||
const findIt = await this._integration.model.integration.findFirst({
|
||||
const findIt = await this._integration.model.integration.findMany({
|
||||
where: {
|
||||
organizationId: {
|
||||
not: org,
|
||||
},
|
||||
rootInternalId: id.split('_').pop(),
|
||||
},
|
||||
select: {
|
||||
organizationId: true,
|
||||
id: true,
|
||||
},
|
||||
});
|
||||
|
||||
return findIt;
|
||||
return findIt.some((f) => f.organizationId === org) || findIt.length === 0;
|
||||
}
|
||||
|
||||
updateProviderSettings(org: string, id: string, settings: string) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue