From 52bf3daa80c171d96cef58885f1e497e97243261 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Thu, 20 Jun 2024 10:49:13 +0300 Subject: [PATCH 1/2] fix(prisma): Add prisma module Needed to prevent creation of many PrismaService instances --- apps/api/src/app/app.module.ts | 3 ++- apps/api/src/prisma/prisma.module.ts | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 apps/api/src/prisma/prisma.module.ts diff --git a/apps/api/src/app/app.module.ts b/apps/api/src/app/app.module.ts index 6a3de56d7..833f2aee2 100644 --- a/apps/api/src/app/app.module.ts +++ b/apps/api/src/app/app.module.ts @@ -61,6 +61,7 @@ import { StatisticsModule } from '../statistics/statistics.module' import { AffiliateModule } from '../affiliate/affiliate.module' import { LoggerModule } from '../logger/logger.module' +import { PrismaModule } from '../prisma/prisma.module' @Module({ imports: [ @@ -130,7 +131,7 @@ import { LoggerModule } from '../logger/logger.module' controllers: [AppController], providers: [ AppService, - PrismaService, + PrismaModule, EmailService, TemplateService, { diff --git a/apps/api/src/prisma/prisma.module.ts b/apps/api/src/prisma/prisma.module.ts new file mode 100644 index 000000000..75bca02cc --- /dev/null +++ b/apps/api/src/prisma/prisma.module.ts @@ -0,0 +1,8 @@ +import { Module } from '@nestjs/common' +import { PrismaService } from './prisma.service' + +@Module({ + providers: [PrismaService], + exports: [PrismaService], +}) +export class PrismaModule {} From 5f8e7be11857eb2277aaa45977a321ee0c3b7c02 Mon Sep 17 00:00:00 2001 From: Alexander Petkov Date: Thu, 20 Jun 2024 11:06:22 +0300 Subject: [PATCH 2/2] chore: Replace PersonService provider with PersonModule import --- apps/api/src/affiliate/affiliate.module.ts | 6 +++--- apps/api/src/auth/auth.module.ts | 7 ++++--- .../bank-transactions-file.module.ts | 4 ++-- .../bank-transactions/bank-transactions.module.ts | 5 +++-- apps/api/src/bankaccount/bankaccount.module.ts | 5 +++-- apps/api/src/benefactor/benefactor.module.ts | 5 +++-- apps/api/src/beneficiary/beneficiary.module.ts | 5 +++-- apps/api/src/campaign-file/campaign-file.module.ts | 13 +++---------- .../campaign-news-file/campaign-news-file.module.ts | 6 +++--- apps/api/src/campaign-news/campaign-news.module.ts | 6 +++--- .../api/src/campaign-types/campaign-types.module.ts | 5 +++-- apps/api/src/campaign/campaign.module.ts | 4 +++- apps/api/src/city/city.module.ts | 5 +++-- apps/api/src/company/company.module.ts | 5 +++-- apps/api/src/coordinator/coordinator.module.ts | 5 +++-- apps/api/src/country/country.module.ts | 5 +++-- apps/api/src/document/document.module.ts | 5 +++-- apps/api/src/donations/donations.module.ts | 3 ++- apps/api/src/expenses/expenses.module.ts | 5 +++-- apps/api/src/info-request/info-request.module.ts | 11 +++-------- .../irregularity-file/irregularity-file.module.ts | 12 +++--------- apps/api/src/irregularity/irregularity.module.ts | 5 +++-- apps/api/src/notifications/notifications.module.ts | 5 ++--- apps/api/src/organizer/organizer.module.ts | 5 +++-- apps/api/src/person/person.module.ts | 6 +++--- .../recurring-donation/recurring-donation.module.ts | 5 +++-- apps/api/src/support/support.module.ts | 2 ++ apps/api/src/transfer/transfer.module.ts | 6 +++--- apps/api/src/vault/vault.module.ts | 11 ++++++++--- apps/api/src/withdrawal/withdrawal.module.ts | 5 +++-- 30 files changed, 92 insertions(+), 85 deletions(-) diff --git a/apps/api/src/affiliate/affiliate.module.ts b/apps/api/src/affiliate/affiliate.module.ts index dd834f2ee..ba52302e6 100644 --- a/apps/api/src/affiliate/affiliate.module.ts +++ b/apps/api/src/affiliate/affiliate.module.ts @@ -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 {} diff --git a/apps/api/src/auth/auth.module.ts b/apps/api/src/auth/auth.module.ts index ad5aa565e..2990535d2 100644 --- a/apps/api/src/auth/auth.module.ts +++ b/apps/api/src/auth/auth.module.ts @@ -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' @@ -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, @@ -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 {} diff --git a/apps/api/src/bank-transactions-file/bank-transactions-file.module.ts b/apps/api/src/bank-transactions-file/bank-transactions-file.module.ts index 95827136e..0e40649fb 100644 --- a/apps/api/src/bank-transactions-file/bank-transactions-file.module.ts +++ b/apps/api/src/bank-transactions-file/bank-transactions-file.module.ts @@ -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' @@ -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: [ @@ -22,11 +22,11 @@ import { MarketingNotificationsModule } from '../notifications/notifications.mod }), NotificationModule, MarketingNotificationsModule, + PrismaModule, ], controllers: [BankTransactionsFileController], providers: [ BankTransactionsFileService, - PrismaService, S3Service, PersonService, VaultService, diff --git a/apps/api/src/bank-transactions/bank-transactions.module.ts b/apps/api/src/bank-transactions/bank-transactions.module.ts index 319d36820..f41a3ad23 100644 --- a/apps/api/src/bank-transactions/bank-transactions.module.ts +++ b/apps/api/src/bank-transactions/bank-transactions.module.ts @@ -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' @@ -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: [ @@ -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 {} diff --git a/apps/api/src/bankaccount/bankaccount.module.ts b/apps/api/src/bankaccount/bankaccount.module.ts index 5ab0bb682..1a577cc58 100644 --- a/apps/api/src/bankaccount/bankaccount.module.ts +++ b/apps/api/src/bankaccount/bankaccount.module.ts @@ -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 {} diff --git a/apps/api/src/benefactor/benefactor.module.ts b/apps/api/src/benefactor/benefactor.module.ts index e8b4668d4..8c9baabc4 100644 --- a/apps/api/src/benefactor/benefactor.module.ts +++ b/apps/api/src/benefactor/benefactor.module.ts @@ -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 {} diff --git a/apps/api/src/beneficiary/beneficiary.module.ts b/apps/api/src/beneficiary/beneficiary.module.ts index 160800a72..247b615d5 100644 --- a/apps/api/src/beneficiary/beneficiary.module.ts +++ b/apps/api/src/beneficiary/beneficiary.module.ts @@ -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 {} diff --git a/apps/api/src/campaign-file/campaign-file.module.ts b/apps/api/src/campaign-file/campaign-file.module.ts index cf88a6ecb..92af71d3e 100644 --- a/apps/api/src/campaign-file/campaign-file.module.ts +++ b/apps/api/src/campaign-file/campaign-file.module.ts @@ -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 {} diff --git a/apps/api/src/campaign-news-file/campaign-news-file.module.ts b/apps/api/src/campaign-news-file/campaign-news-file.module.ts index 669cabbab..131d1cfa0 100644 --- a/apps/api/src/campaign-news-file/campaign-news-file.module.ts +++ b/apps/api/src/campaign-news-file/campaign-news-file.module.ts @@ -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 {} diff --git a/apps/api/src/campaign-news/campaign-news.module.ts b/apps/api/src/campaign-news/campaign-news.module.ts index e1d3df1d6..81c46ffdb 100644 --- a/apps/api/src/campaign-news/campaign-news.module.ts +++ b/apps/api/src/campaign-news/campaign-news.module.ts @@ -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 {} diff --git a/apps/api/src/campaign-types/campaign-types.module.ts b/apps/api/src/campaign-types/campaign-types.module.ts index 4b168a1d8..5cd5bf5ae 100644 --- a/apps/api/src/campaign-types/campaign-types.module.ts +++ b/apps/api/src/campaign-types/campaign-types.module.ts @@ -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 {} diff --git a/apps/api/src/campaign/campaign.module.ts b/apps/api/src/campaign/campaign.module.ts index ab39c921d..f478d2472 100644 --- a/apps/api/src/campaign/campaign.module.ts +++ b/apps/api/src/campaign/campaign.module.ts @@ -10,16 +10,18 @@ import { CampaignService } from './campaign.service' 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], }) diff --git a/apps/api/src/city/city.module.ts b/apps/api/src/city/city.module.ts index 4f195362d..a2bb8e810 100644 --- a/apps/api/src/city/city.module.ts +++ b/apps/api/src/city/city.module.ts @@ -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 {} diff --git a/apps/api/src/company/company.module.ts b/apps/api/src/company/company.module.ts index a64abcf44..f7212e732 100644 --- a/apps/api/src/company/company.module.ts +++ b/apps/api/src/company/company.module.ts @@ -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 {} diff --git a/apps/api/src/coordinator/coordinator.module.ts b/apps/api/src/coordinator/coordinator.module.ts index 8c66f1cea..fe3cc8fb9 100644 --- a/apps/api/src/coordinator/coordinator.module.ts +++ b/apps/api/src/coordinator/coordinator.module.ts @@ -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 {} diff --git a/apps/api/src/country/country.module.ts b/apps/api/src/country/country.module.ts index 67cc81ac6..eaa322ea2 100644 --- a/apps/api/src/country/country.module.ts +++ b/apps/api/src/country/country.module.ts @@ -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 {} diff --git a/apps/api/src/document/document.module.ts b/apps/api/src/document/document.module.ts index 8b9f6e9fd..562642910 100644 --- a/apps/api/src/document/document.module.ts +++ b/apps/api/src/document/document.module.ts @@ -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 {} diff --git a/apps/api/src/donations/donations.module.ts b/apps/api/src/donations/donations.module.ts index 613a47fe8..7ae327401 100644 --- a/apps/api/src/donations/donations.module.ts +++ b/apps/api/src/donations/donations.module.ts @@ -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: [ @@ -33,6 +34,7 @@ import { EmailService } from '../email/email.service' ExportModule, NotificationModule, MarketingNotificationsModule, + PrismaModule, ], controllers: [DonationsController], providers: [ @@ -40,7 +42,6 @@ import { EmailService } from '../email/email.service' StripePaymentService, CampaignService, RecurringDonationService, - PrismaService, VaultService, PersonService, ExportService, diff --git a/apps/api/src/expenses/expenses.module.ts b/apps/api/src/expenses/expenses.module.ts index b50c20c01..0be2d5eec 100644 --- a/apps/api/src/expenses/expenses.module.ts +++ b/apps/api/src/expenses/expenses.module.ts @@ -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 {} diff --git a/apps/api/src/info-request/info-request.module.ts b/apps/api/src/info-request/info-request.module.ts index e87d5b34d..15a452f00 100644 --- a/apps/api/src/info-request/info-request.module.ts +++ b/apps/api/src/info-request/info-request.module.ts @@ -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 {} diff --git a/apps/api/src/irregularity-file/irregularity-file.module.ts b/apps/api/src/irregularity-file/irregularity-file.module.ts index be3356d19..40c102354 100644 --- a/apps/api/src/irregularity-file/irregularity-file.module.ts +++ b/apps/api/src/irregularity-file/irregularity-file.module.ts @@ -1,21 +1,15 @@ import { Module } from '@nestjs/common' import { IrregularityFileService } from './irregularity-file.service' import { IrregularityFileController } from './irregularity-file.controller' -import { PrismaService } from '../prisma/prisma.service' import { S3Service } from '../s3/s3.service' import { PersonService } from '../person/person.service' import { IrregularityService } from '../irregularity/irregularity.service' import { ConfigModule } from '@nestjs/config' +import { PrismaModule } from '../prisma/prisma.module' @Module({ - imports: [ConfigModule], + imports: [ConfigModule, PrismaModule], controllers: [IrregularityFileController], - providers: [ - IrregularityFileService, - IrregularityService, - PrismaService, - S3Service, - PersonService, - ], + providers: [IrregularityFileService, IrregularityService, S3Service, PersonService], }) export class IrregularityFileModule {} diff --git a/apps/api/src/irregularity/irregularity.module.ts b/apps/api/src/irregularity/irregularity.module.ts index 582ccd9ef..e412a9f3f 100644 --- a/apps/api/src/irregularity/irregularity.module.ts +++ b/apps/api/src/irregularity/irregularity.module.ts @@ -2,11 +2,12 @@ import { Module } from '@nestjs/common' import { IrregularityService } from './irregularity.service' import { IrregularityController } from './irregularity.controller' import { IrregularityFileService } from '../irregularity-file/irregularity-file.service' -import { PrismaService } from '../prisma/prisma.service' import { S3Service } from '../s3/s3.service' +import { PrismaModule } from '../prisma/prisma.module' @Module({ + imports: [PrismaModule], controllers: [IrregularityController], - providers: [IrregularityService, PrismaService, IrregularityFileService, S3Service], + providers: [IrregularityService, IrregularityFileService, S3Service], }) export class IrregularityModule {} diff --git a/apps/api/src/notifications/notifications.module.ts b/apps/api/src/notifications/notifications.module.ts index 5f1283b4a..fc809cbab 100644 --- a/apps/api/src/notifications/notifications.module.ts +++ b/apps/api/src/notifications/notifications.module.ts @@ -12,9 +12,10 @@ import { CampaignService } from '../campaign/campaign.service' import { VaultService } from '../vault/vault.service' import { NotificationService } from '../sockets/notifications/notification.service' import { NotificationGateway } from '../sockets/notifications/gateway' +import { PrismaModule } from '../prisma/prisma.module' @Module({ - imports: [ConfigModule], + imports: [ConfigModule, PrismaModule], providers: [ { // Use the interface as token @@ -22,7 +23,6 @@ import { NotificationGateway } from '../sockets/notifications/gateway' // But actually provide the service that implements the interface useClass: SendGridNotificationsProvider, }, - PrismaService, PersonService, EmailService, TemplateService, @@ -35,7 +35,6 @@ import { NotificationGateway } from '../sockets/notifications/gateway' ], controllers: [MarketingNotificationsController], exports: [ - PrismaService, PersonService, EmailService, TemplateService, diff --git a/apps/api/src/organizer/organizer.module.ts b/apps/api/src/organizer/organizer.module.ts index 93f712c32..13442e74b 100644 --- a/apps/api/src/organizer/organizer.module.ts +++ b/apps/api/src/organizer/organizer.module.ts @@ -1,10 +1,11 @@ import { Module } from '@nestjs/common' import { OrganizerService } from './organizer.service' import { OrganizerController } from './organizer.controller' -import { PrismaService } from '../prisma/prisma.service' +import { PrismaModule } from '../prisma/prisma.module' @Module({ + imports: [PrismaModule], controllers: [OrganizerController], - providers: [OrganizerService, PrismaService], + providers: [OrganizerService], }) export class OrganizerModule {} diff --git a/apps/api/src/person/person.module.ts b/apps/api/src/person/person.module.ts index cacb9f0a3..c238437c8 100644 --- a/apps/api/src/person/person.module.ts +++ b/apps/api/src/person/person.module.ts @@ -1,13 +1,13 @@ import { Module } from '@nestjs/common' import { PersonService } from './person.service' import { PersonController } from './person.controller' -import { PrismaService } from '../prisma/prisma.service' import { ConfigModule } from '@nestjs/config' +import { PrismaModule } from '../prisma/prisma.module' @Module({ - imports: [ConfigModule], + imports: [ConfigModule, PrismaModule], controllers: [PersonController], - providers: [PersonService, PrismaService], + providers: [PersonService], exports: [PersonService], }) export class PersonModule {} diff --git a/apps/api/src/recurring-donation/recurring-donation.module.ts b/apps/api/src/recurring-donation/recurring-donation.module.ts index ce67bfe91..3a7847f32 100644 --- a/apps/api/src/recurring-donation/recurring-donation.module.ts +++ b/apps/api/src/recurring-donation/recurring-donation.module.ts @@ -1,11 +1,11 @@ import { Module } from '@nestjs/common' import { RecurringDonationService } from './recurring-donation.service' import { RecurringDonationController } from './recurring-donation.controller' -import { PrismaService } from '../prisma/prisma.service' import { HttpModule } from '@nestjs/axios' import { StripeModule } from '@golevelup/nestjs-stripe' import { ConfigService } from '@nestjs/config' import { StripeConfigFactory } from '../donations/helpers/stripe-config-factory' +import { PrismaModule } from '../prisma/prisma.module' @Module({ imports: [ @@ -14,9 +14,10 @@ import { StripeConfigFactory } from '../donations/helpers/stripe-config-factory' useFactory: StripeConfigFactory.useFactory, }), HttpModule, + PrismaModule, ], controllers: [RecurringDonationController], - providers: [PrismaService, RecurringDonationService], + providers: [RecurringDonationService], }) export class RecurringDonationModule {} diff --git a/apps/api/src/support/support.module.ts b/apps/api/src/support/support.module.ts index 46abf56c2..d053cd7ed 100644 --- a/apps/api/src/support/support.module.ts +++ b/apps/api/src/support/support.module.ts @@ -5,8 +5,10 @@ import { TemplateService } from '../email/template.service' import { PrismaService } from '../prisma/prisma.service' import { SupportController } from './support.controller' import { SupportService } from './support.service' +import { PrismaModule } from '../prisma/prisma.module' @Module({ + imports: [PrismaModule], controllers: [SupportController], providers: [SupportService, PrismaService, EmailService, TemplateService], }) diff --git a/apps/api/src/transfer/transfer.module.ts b/apps/api/src/transfer/transfer.module.ts index 8b02c46a6..9f9fd04a6 100644 --- a/apps/api/src/transfer/transfer.module.ts +++ b/apps/api/src/transfer/transfer.module.ts @@ -1,12 +1,12 @@ import { Module } from '@nestjs/common' -import { PrismaService } from '../prisma/prisma.service' - import { TransferService } from './transfer.service' import { TransferController } from './transfer.controller' +import { PrismaModule } from '../prisma/prisma.module' @Module({ + imports: [PrismaModule], controllers: [TransferController], - providers: [TransferService, PrismaService], + providers: [TransferService], }) export class TransferModule {} diff --git a/apps/api/src/vault/vault.module.ts b/apps/api/src/vault/vault.module.ts index 337345830..ba5a12236 100644 --- a/apps/api/src/vault/vault.module.ts +++ b/apps/api/src/vault/vault.module.ts @@ -3,16 +3,21 @@ import { ConfigService } from '@nestjs/config' import { CampaignModule } from '../campaign/campaign.module' import { CampaignService } from '../campaign/campaign.service' import { PersonService } from '../person/person.service' -import { PrismaService } from '../prisma/prisma.service' import { VaultController } from './vault.controller' import { VaultService } from './vault.service' import { NotificationModule } from '../sockets/notifications/notification.module' import { MarketingNotificationsModule } from '../notifications/notifications.module' +import { PrismaModule } from '../prisma/prisma.module' @Module({ - imports: [forwardRef(() => CampaignModule), NotificationModule, MarketingNotificationsModule], + imports: [ + forwardRef(() => CampaignModule), + NotificationModule, + MarketingNotificationsModule, + PrismaModule, + ], controllers: [VaultController], - providers: [VaultService, CampaignService, PrismaService, PersonService, ConfigService], + providers: [VaultService, CampaignService, PersonService, ConfigService], exports: [VaultService], }) export class VaultModule {} diff --git a/apps/api/src/withdrawal/withdrawal.module.ts b/apps/api/src/withdrawal/withdrawal.module.ts index f030bd82d..e8093bd42 100644 --- a/apps/api/src/withdrawal/withdrawal.module.ts +++ b/apps/api/src/withdrawal/withdrawal.module.ts @@ -1,10 +1,11 @@ import { Module } from '@nestjs/common' import { WithdrawalService } from './withdrawal.service' import { WithdrawalController } from './withdrawal.controller' -import { PrismaService } from '../prisma/prisma.service' +import { PrismaModule } from '../prisma/prisma.module' @Module({ + imports: [PrismaModule], controllers: [WithdrawalController], - providers: [WithdrawalService, PrismaService], + providers: [WithdrawalService], }) export class WithdrawalModule {}