service.module.ts 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. import { Module } from '@nestjs/common';
  2. import { TypeOrmModule } from '@nestjs/typeorm';
  3. import { getConfig } from '../config/config-helpers';
  4. import { ConfigModule } from '../config/config.module';
  5. import { EventBusModule } from '../event-bus/event-bus.module';
  6. import { AssetUpdater } from './helpers/asset-updater/asset-updater';
  7. import { ListQueryBuilder } from './helpers/list-query-builder/list-query-builder';
  8. import { OrderCalculator } from './helpers/order-calculator/order-calculator';
  9. import { OrderMerger } from './helpers/order-merger/order-merger';
  10. import { OrderStateMachine } from './helpers/order-state-machine/order-state-machine';
  11. import { PasswordCiper } from './helpers/password-cipher/password-ciper';
  12. import { ShippingCalculator } from './helpers/shipping-calculator/shipping-calculator';
  13. import { TaxCalculator } from './helpers/tax-calculator/tax-calculator';
  14. import { TranslatableSaver } from './helpers/translatable-saver/translatable-saver';
  15. import { AdministratorService } from './services/administrator.service';
  16. import { AssetService } from './services/asset.service';
  17. import { AuthService } from './services/auth.service';
  18. import { ChannelService } from './services/channel.service';
  19. import { CountryService } from './services/country.service';
  20. import { CustomerGroupService } from './services/customer-group.service';
  21. import { CustomerService } from './services/customer.service';
  22. import { FacetValueService } from './services/facet-value.service';
  23. import { FacetService } from './services/facet.service';
  24. import { OrderService } from './services/order.service';
  25. import { PaymentMethodService } from './services/payment-method.service';
  26. import { ProductCategoryService } from './services/product-category.service';
  27. import { ProductOptionGroupService } from './services/product-option-group.service';
  28. import { ProductOptionService } from './services/product-option.service';
  29. import { ProductVariantService } from './services/product-variant.service';
  30. import { ProductService } from './services/product.service';
  31. import { PromotionService } from './services/promotion.service';
  32. import { RoleService } from './services/role.service';
  33. import { ShippingMethodService } from './services/shipping-method.service';
  34. import { TaxCategoryService } from './services/tax-category.service';
  35. import { TaxRateService } from './services/tax-rate.service';
  36. import { UserService } from './services/user.service';
  37. import { ZoneService } from './services/zone.service';
  38. const exportedProviders = [
  39. PromotionService,
  40. AdministratorService,
  41. AssetService,
  42. AuthService,
  43. ChannelService,
  44. CountryService,
  45. CustomerGroupService,
  46. CustomerService,
  47. FacetService,
  48. FacetValueService,
  49. OrderService,
  50. PaymentMethodService,
  51. ProductCategoryService,
  52. ProductOptionService,
  53. ProductOptionGroupService,
  54. ProductService,
  55. ProductVariantService,
  56. RoleService,
  57. ShippingMethodService,
  58. TaxCategoryService,
  59. TaxRateService,
  60. UserService,
  61. ZoneService,
  62. ];
  63. /**
  64. * The ServiceModule is responsible for the service layer, i.e. accessing the database
  65. * and implementing the main business logic of the application.
  66. *
  67. * The exported providers are used in the ApiModule, which is responsible for parsing requests
  68. * into a format suitable for the service layer logic.
  69. */
  70. @Module({
  71. imports: [ConfigModule, EventBusModule, TypeOrmModule.forRoot(getConfig().dbConnectionOptions)],
  72. providers: [
  73. ...exportedProviders,
  74. PasswordCiper,
  75. TranslatableSaver,
  76. TaxCalculator,
  77. OrderCalculator,
  78. OrderStateMachine,
  79. OrderMerger,
  80. ListQueryBuilder,
  81. ShippingCalculator,
  82. AssetUpdater,
  83. ],
  84. exports: exportedProviders,
  85. })
  86. export class ServiceModule {}