Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(prisma): Too many idle db connections #646

Merged
merged 2 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions apps/api/src/affiliate/affiliate.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import { Module } from '@nestjs/common'
import { AffiliateController } from './affiliate.controller'
import { AffiliateService } from './affiliate.service'
import { PersonModule } from '../person/person.module'
import { PrismaService } from '../prisma/prisma.service'
import { DonationsModule } from '../donations/donations.module'
import { CampaignModule } from '../campaign/campaign.module'
import { PrismaModule } from '../prisma/prisma.module'

@Module({
controllers: [AffiliateController],
providers: [AffiliateService, PrismaService],
imports: [PersonModule, DonationsModule, CampaignModule],
providers: [AffiliateService],
imports: [PersonModule, DonationsModule, CampaignModule, PrismaModule],
exports: [AffiliateService],
})
export class AffiliateModule {}
3 changes: 2 additions & 1 deletion apps/api/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import { AppController } from './app.controller'
import { CustomAuthGuard } from './custom-auth.guard'
import configuration from '../config/configuration'
import { PrismaService } from '../prisma/prisma.service'

Check warning on line 14 in apps/api/src/app/app.module.ts

View workflow job for this annotation

GitHub Actions / Run API tests

'PrismaService' is defined but never used
import { AccountModule } from '../account/account.module'
import { HealthModule } from '../health/health.module'
import { SupportModule } from '../support/support.module'
Expand Down Expand Up @@ -61,6 +61,7 @@
import { AffiliateModule } from '../affiliate/affiliate.module'

import { LoggerModule } from '../logger/logger.module'
import { PrismaModule } from '../prisma/prisma.module'

@Module({
imports: [
Expand Down Expand Up @@ -130,7 +131,7 @@
controllers: [AppController],
providers: [
AppService,
PrismaService,
PrismaModule,
EmailService,
TemplateService,
{
Expand Down
7 changes: 4 additions & 3 deletions apps/api/src/auth/auth.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { KeycloakConnectModule } from 'nest-keycloak-connect'

import { AuthService } from './auth.service'
import { LoginController } from './login.controller'
import { PrismaService } from '../prisma/prisma.service'
import { RegisterController } from './register.controller'
import { AppConfigModule } from '../config/app-config.module'
import { KeycloakConfigService } from '../config/keycloak-config.service'
Expand All @@ -15,10 +14,9 @@ import { EmailService } from '../email/email.service'
import { TemplateService } from '../email/template.service'
import { MarketingNotificationsModule } from '../notifications/notifications.module'
import { CompanyModule } from '../company/company.module'
import { PrismaModule } from '../prisma/prisma.module'

@Module({
controllers: [LoginController, RegisterController, RefreshController, ProviderLoginController],
providers: [AuthService, PrismaService, EmailService, JwtService, TemplateService],
imports: [
AppConfigModule,
HttpModule,
Expand All @@ -29,7 +27,10 @@ import { CompanyModule } from '../company/company.module'
}),
MarketingNotificationsModule,
CompanyModule,
PrismaModule,
],
controllers: [LoginController, RegisterController, RefreshController, ProviderLoginController],
providers: [AuthService, EmailService, JwtService, TemplateService],
exports: [AuthService],
})
export class AuthModule {}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Module } from '@nestjs/common'
import { BankTransactionsFileService } from './bank-transactions-file.service'
import { BankTransactionsFileController } from './bank-transactions-file.controller'
import { PrismaService } from '../prisma/prisma.service'
import { S3Service } from '../s3/s3.service'
import { PersonService } from '../person/person.service'
import { DonationsService } from '../donations/donations.service'
Expand All @@ -13,6 +12,7 @@ import { StripeConfigFactory } from '../donations/helpers/stripe-config-factory'
import { ExportService } from '../export/export.service'
import { NotificationModule } from '../sockets/notifications/notification.module'
import { MarketingNotificationsModule } from '../notifications/notifications.module'
import { PrismaModule } from '../prisma/prisma.module'

@Module({
imports: [
Expand All @@ -22,11 +22,11 @@ import { MarketingNotificationsModule } from '../notifications/notifications.mod
}),
NotificationModule,
MarketingNotificationsModule,
PrismaModule,
],
controllers: [BankTransactionsFileController],
providers: [
BankTransactionsFileService,
PrismaService,
S3Service,
PersonService,
VaultService,
Expand Down
5 changes: 3 additions & 2 deletions apps/api/src/bank-transactions/bank-transactions.module.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Module } from '@nestjs/common'
import { CampaignModule } from '../campaign/campaign.module'
import { DonationsModule } from '../donations/donations.module'
import { PrismaService } from '../prisma/prisma.service'
import { BankTransactionsController } from './bank-transactions.controller'
import { BankTransactionsService } from './bank-transactions.service'
import { ConfigModule } from '@nestjs/config'
Expand All @@ -11,6 +10,7 @@ import { HttpModule } from '@nestjs/axios'
import { EmailService } from '../email/email.service'
import { TemplateService } from '../email/template.service'
import { AffiliateModule } from '../affiliate/affiliate.module'
import { PrismaModule } from '../prisma/prisma.module'

@Module({
imports: [
Expand All @@ -20,9 +20,10 @@ import { AffiliateModule } from '../affiliate/affiliate.module'
ExportModule,
HttpModule,
AffiliateModule,
PrismaModule,
],
controllers: [BankTransactionsController],
providers: [BankTransactionsService, PrismaService, IrisTasks, EmailService, TemplateService], //TODO: Create Email module to not need to import each service
providers: [BankTransactionsService, IrisTasks, EmailService, TemplateService], //TODO: Create Email module to not need to import each service
exports: [BankTransactionsService],
})
export class BankTransactionsModule {}
5 changes: 3 additions & 2 deletions apps/api/src/bankaccount/bankaccount.module.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { Module } from '@nestjs/common'
import { BankAccountService } from './bankaccount.service'
import { BankAccountController } from './bankaccount.controller'
import { PrismaService } from '../prisma/prisma.service'
import { PrismaModule } from '../prisma/prisma.module'

@Module({
imports: [PrismaModule],
controllers: [BankAccountController],
providers: [BankAccountService, PrismaService],
providers: [BankAccountService],
})
export class BankAccountModule {}
5 changes: 3 additions & 2 deletions apps/api/src/benefactor/benefactor.module.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { Module } from '@nestjs/common'
import { BenefactorService } from './benefactor.service'
import { BenefactorController } from './benefactor.controller'
import { PrismaService } from '../prisma/prisma.service'
import { PrismaModule } from '../prisma/prisma.module'

@Module({
imports: [PrismaModule],
controllers: [BenefactorController],
providers: [BenefactorService, PrismaService],
providers: [BenefactorService],
})
export class BenefactorModule {}
5 changes: 3 additions & 2 deletions apps/api/src/beneficiary/beneficiary.module.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { Module } from '@nestjs/common'
import { PrismaService } from '../prisma/prisma.service'
import { BeneficiaryController } from './beneficiary.controller'
import { BeneficiaryService } from './beneficiary.service'
import { PrismaModule } from '../prisma/prisma.module'

@Module({
imports: [PrismaModule],
controllers: [BeneficiaryController],
providers: [BeneficiaryService, PrismaService],
providers: [BeneficiaryService],
})
export class BeneficiaryModule {}
13 changes: 3 additions & 10 deletions apps/api/src/campaign-file/campaign-file.module.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,18 @@
import { Module } from '@nestjs/common'
import { CampaignFileService } from './campaign-file.service'
import { CampaignFileController } from './campaign-file.controller'
import { PrismaService } from '../prisma/prisma.service'
import { S3Service } from '../s3/s3.service'
import { PersonService } from '../person/person.service'
import { CampaignService } from '../campaign/campaign.service'
import { VaultService } from '../vault/vault.service'
import { NotificationModule } from '../sockets/notifications/notification.module'
import { MarketingNotificationsModule } from '../notifications/notifications.module'
import { PrismaModule } from '../prisma/prisma.module'

@Module({
imports: [NotificationModule, MarketingNotificationsModule],
imports: [NotificationModule, MarketingNotificationsModule, PrismaModule],

controllers: [CampaignFileController],
providers: [
CampaignFileService,
PrismaService,
S3Service,
PersonService,
CampaignService,
VaultService,
],
providers: [CampaignFileService, S3Service, PersonService, CampaignService, VaultService],
})
export class CampaignFileModule {}
6 changes: 3 additions & 3 deletions apps/api/src/campaign-news-file/campaign-news-file.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import { CampaignNewsFileController } from './campaign-news-file.controller'
import { S3Service } from '../s3/s3.service'
import { PersonModule } from '../person/person.module'
import { CampaignNewsModule } from '../campaign-news/campaign-news.module'
import { PrismaService } from '../prisma/prisma.service'
import { PrismaModule } from '../prisma/prisma.module'

@Module({
imports: [CampaignNewsModule, PersonModule, PrismaModule],
controllers: [CampaignNewsFileController],
imports: [CampaignNewsModule, PersonModule],
providers: [CampaignNewsFileService, PrismaService, S3Service],
providers: [CampaignNewsFileService, S3Service],
})
export class CampaignNewsFileModule {}
6 changes: 3 additions & 3 deletions apps/api/src/campaign-news/campaign-news.module.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { Module } from '@nestjs/common'
import { CampaignNewsService } from './campaign-news.service'
import { CampaignNewsController } from './campaign-news.controller'
import { PrismaService } from '../prisma/prisma.service'
import { PersonModule } from '../person/person.module'
import { MarketingNotificationsModule } from '../notifications/notifications.module'
import { ConfigService } from '@nestjs/config'
import { EmailService } from '../email/email.service'
import { PrismaModule } from '../prisma/prisma.module'

@Module({
imports: [PersonModule, MarketingNotificationsModule],
imports: [PersonModule, MarketingNotificationsModule, PrismaModule],
controllers: [CampaignNewsController],
providers: [CampaignNewsService, PrismaService, ConfigService, EmailService],
providers: [CampaignNewsService, ConfigService, EmailService],
exports: [CampaignNewsService],
})
export class CampaignNewsModule {}
5 changes: 3 additions & 2 deletions apps/api/src/campaign-types/campaign-types.module.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { Module } from '@nestjs/common'
import { CampaignTypesService } from './campaign-types.service'
import { CampaignTypesController } from './campaign-types.controller'
import { PrismaService } from '../prisma/prisma.service'
import { PrismaModule } from '../prisma/prisma.module'

@Module({
imports: [PrismaModule],
controllers: [CampaignTypesController],
providers: [CampaignTypesService, PrismaService],
providers: [CampaignTypesService],
})
export class CampaignTypesModule {}
4 changes: 3 additions & 1 deletion apps/api/src/campaign/campaign.module.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { forwardRef, Module } from '@nestjs/common'
import { ConfigService } from '@nestjs/config'
import { PersonService } from '../person/person.service'
import { PrismaService } from '../prisma/prisma.service'

Check warning on line 4 in apps/api/src/campaign/campaign.module.ts

View workflow job for this annotation

GitHub Actions / Run API tests

'PrismaService' is defined but never used
import { VaultModule } from '../vault/vault.module'
import { VaultService } from '../vault/vault.service'
import { CampaignTypeController } from './campaign-type.controller'
Expand All @@ -10,16 +10,18 @@
import { NotificationModule } from '../sockets/notifications/notification.module'
import { CampaignNewsModule } from '../campaign-news/campaign-news.module'
import { MarketingNotificationsModule } from '../notifications/notifications.module'
import { PrismaModule } from '../prisma/prisma.module'
@Module({
imports: [
forwardRef(() => VaultModule),
MarketingNotificationsModule,
NotificationModule,
CampaignNewsModule,
PrismaModule,
],

controllers: [CampaignController, CampaignTypeController],
providers: [CampaignService, PrismaService, VaultService, PersonService, ConfigService],
providers: [CampaignService, VaultService, PersonService, ConfigService],

exports: [CampaignService],
})
Expand Down
5 changes: 3 additions & 2 deletions apps/api/src/city/city.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ import { Module } from '@nestjs/common'

import { CityService } from './city.service'
import { CityController } from './city.controller'
import { PrismaService } from '../prisma/prisma.service'
import { PrismaModule } from '../prisma/prisma.module'

@Module({
imports: [PrismaModule],
controllers: [CityController],
providers: [CityService, PrismaService],
providers: [CityService],
})
export class CityModule {}
5 changes: 3 additions & 2 deletions apps/api/src/company/company.module.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { Module } from '@nestjs/common'
import { CompanyService } from './company.service'
import { CompanyController } from './company.controller'
import { PrismaService } from '../prisma/prisma.service'
import { PrismaModule } from '../prisma/prisma.module'

@Module({
imports: [PrismaModule],
controllers: [CompanyController],
providers: [CompanyService, PrismaService],
providers: [CompanyService],
exports: [CompanyService],
})
export class CompanyModule {}
5 changes: 3 additions & 2 deletions apps/api/src/coordinator/coordinator.module.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { Module } from '@nestjs/common'
import { CoordinatorService } from './coordinator.service'
import { CoordinatorController } from './coordinator.controller'
import { PrismaService } from '../prisma/prisma.service'
import { PrismaModule } from '../prisma/prisma.module'

@Module({
imports: [PrismaModule],
controllers: [CoordinatorController],
providers: [CoordinatorService, PrismaService],
providers: [CoordinatorService],
})
export class CoordinatorModule {}
5 changes: 3 additions & 2 deletions apps/api/src/country/country.module.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { Module } from '@nestjs/common'
import { CountryService } from './country.service'
import { CountryController } from './country.controller'
import { PrismaService } from '../prisma/prisma.service'
import { PrismaModule } from '../prisma/prisma.module'

@Module({
imports: [PrismaModule],
controllers: [CountryController],
providers: [CountryService, PrismaService],
providers: [CountryService],
})
export class CountryModule {}
5 changes: 3 additions & 2 deletions apps/api/src/document/document.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ import { Module } from '@nestjs/common'

import { DocumentService } from './document.service'
import { DocumentController } from './document.controller'
import { PrismaService } from '../prisma/prisma.service'
import { PrismaModule } from '../prisma/prisma.module'

@Module({
imports: [PrismaModule],
controllers: [DocumentController],
providers: [DocumentService, PrismaService],
providers: [DocumentService],
})
export class DocumentModule {}
3 changes: 2 additions & 1 deletion apps/api/src/donations/donations.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { ExportModule } from './../export/export.module'
import { NotificationModule } from '../sockets/notifications/notification.module'
import { MarketingNotificationsModule } from '../notifications/notifications.module'
import { EmailService } from '../email/email.service'
import { PrismaModule } from '../prisma/prisma.module'

@Module({
imports: [
Expand All @@ -33,14 +34,14 @@ import { EmailService } from '../email/email.service'
ExportModule,
NotificationModule,
MarketingNotificationsModule,
PrismaModule,
],
controllers: [DonationsController],
providers: [
DonationsService,
StripePaymentService,
CampaignService,
RecurringDonationService,
PrismaService,
VaultService,
PersonService,
ExportService,
Expand Down
5 changes: 3 additions & 2 deletions apps/api/src/expenses/expenses.module.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { Module } from '@nestjs/common'
import { ExpensesService } from './expenses.service'
import { ExpensesController } from './expenses.controller'
import { PrismaService } from '../prisma/prisma.service'
import { S3Service } from '../s3/s3.service'
import { PrismaModule } from '../prisma/prisma.module'

@Module({
imports: [PrismaModule],
controllers: [ExpensesController],
providers: [PrismaService, ExpensesService, S3Service],
providers: [ExpensesService, S3Service],
})
export class ExpensesModule {}
11 changes: 3 additions & 8 deletions apps/api/src/info-request/info-request.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,11 @@ import { SupportService } from '../support/support.service'
import { EmailService } from '../email/email.service'
import { TemplateService } from '../email/template.service'
import { ConfigService } from '@nestjs/config'
import { PrismaModule } from '../prisma/prisma.module'

@Module({
imports: [PrismaModule],
controllers: [InfoRequestController],
providers: [
InfoRequestService,
PrismaService,
SupportService,
EmailService,
TemplateService,
ConfigService,
],
providers: [InfoRequestService, SupportService, EmailService, TemplateService, ConfigService],
})
export class InfoRequestModule {}
Loading
Loading