2025-09-01 15:11:42 +09:00
|
|
|
import { Module } from "@nestjs/common";
|
|
|
|
|
import { RouterModule } from "@nestjs/core";
|
|
|
|
|
import { ConfigModule, ConfigService } from "@nestjs/config";
|
|
|
|
|
import { ThrottlerModule } from "@nestjs/throttler";
|
2025-08-21 15:24:40 +09:00
|
|
|
|
2025-08-30 16:45:22 +09:00
|
|
|
// Configuration
|
2025-09-01 15:11:42 +09:00
|
|
|
import { appConfig } from "./common/config/app.config";
|
|
|
|
|
import { createThrottlerConfig } from "./common/config/throttler.config";
|
|
|
|
|
import { apiRoutes } from "./common/config/router.config";
|
2025-08-20 18:02:50 +09:00
|
|
|
|
2025-08-30 16:45:22 +09:00
|
|
|
// Core Infrastructure Modules
|
2025-09-01 15:11:42 +09:00
|
|
|
import { LoggingModule } from "./common/logging/logging.module";
|
|
|
|
|
import { PrismaModule } from "./common/prisma/prisma.module";
|
|
|
|
|
import { RedisModule } from "./common/redis/redis.module";
|
|
|
|
|
import { CacheModule } from "./common/cache/cache.module";
|
2025-09-06 10:01:44 +09:00
|
|
|
import { QueueModule } from "./common/queue/queue.module";
|
2025-09-01 15:11:42 +09:00
|
|
|
import { AuditModule } from "./common/audit/audit.module";
|
|
|
|
|
import { EmailModule } from "./common/email/email.module";
|
2025-08-30 16:45:22 +09:00
|
|
|
|
|
|
|
|
// External Integration Modules
|
2025-09-01 15:11:42 +09:00
|
|
|
import { VendorsModule } from "./vendors/vendors.module";
|
|
|
|
|
import { JobsModule } from "./jobs/jobs.module";
|
2025-09-06 10:01:44 +09:00
|
|
|
import { SalesforceEventsModule } from "./vendors/salesforce/events/events.module";
|
2025-08-30 16:45:22 +09:00
|
|
|
|
|
|
|
|
// Feature Modules
|
2025-09-01 15:11:42 +09:00
|
|
|
import { AuthModule } from "./auth/auth.module";
|
|
|
|
|
import { UsersModule } from "./users/users.module";
|
|
|
|
|
import { MappingsModule } from "./mappings/mappings.module";
|
|
|
|
|
import { CatalogModule } from "./catalog/catalog.module";
|
|
|
|
|
import { OrdersModule } from "./orders/orders.module";
|
|
|
|
|
import { InvoicesModule } from "./invoices/invoices.module";
|
|
|
|
|
import { SubscriptionsModule } from "./subscriptions/subscriptions.module";
|
|
|
|
|
import { CasesModule } from "./cases/cases.module";
|
2025-08-30 16:45:22 +09:00
|
|
|
|
|
|
|
|
// System Modules
|
2025-09-01 15:11:42 +09:00
|
|
|
import { HealthModule } from "./health/health.module";
|
2025-08-30 16:45:22 +09:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Main application module
|
2025-09-01 15:11:42 +09:00
|
|
|
*
|
2025-08-30 16:45:22 +09:00
|
|
|
* Architecture:
|
|
|
|
|
* - Core infrastructure modules provide foundational services
|
|
|
|
|
* - External integration modules handle third-party services
|
|
|
|
|
* - Feature modules implement business logic
|
|
|
|
|
* - System modules provide monitoring and health checks
|
2025-09-01 15:11:42 +09:00
|
|
|
*
|
2025-08-30 16:45:22 +09:00
|
|
|
* All feature modules are grouped under "/api" prefix via RouterModule
|
|
|
|
|
* Health endpoints remain at root level for monitoring tools
|
|
|
|
|
*/
|
2025-08-20 18:02:50 +09:00
|
|
|
@Module({
|
|
|
|
|
imports: [
|
2025-08-30 16:45:22 +09:00
|
|
|
// === CONFIGURATION ===
|
|
|
|
|
ConfigModule.forRoot(appConfig),
|
2025-08-22 17:02:49 +09:00
|
|
|
|
2025-08-30 16:45:22 +09:00
|
|
|
// === INFRASTRUCTURE ===
|
2025-08-21 15:24:40 +09:00
|
|
|
LoggingModule,
|
2025-08-22 17:02:49 +09:00
|
|
|
ThrottlerModule.forRootAsync({
|
|
|
|
|
imports: [ConfigModule],
|
|
|
|
|
inject: [ConfigService],
|
2025-08-30 16:45:22 +09:00
|
|
|
useFactory: createThrottlerConfig,
|
2025-08-22 17:02:49 +09:00
|
|
|
}),
|
2025-08-20 18:02:50 +09:00
|
|
|
|
2025-08-30 16:45:22 +09:00
|
|
|
// === CORE SERVICES ===
|
2025-08-20 18:02:50 +09:00
|
|
|
PrismaModule,
|
|
|
|
|
RedisModule,
|
2025-08-21 15:24:40 +09:00
|
|
|
CacheModule,
|
2025-09-06 10:01:44 +09:00
|
|
|
QueueModule,
|
2025-08-20 18:02:50 +09:00
|
|
|
AuditModule,
|
2025-08-30 16:45:22 +09:00
|
|
|
EmailModule,
|
|
|
|
|
|
|
|
|
|
// === EXTERNAL INTEGRATIONS ===
|
2025-08-20 18:02:50 +09:00
|
|
|
VendorsModule,
|
2025-09-06 10:01:44 +09:00
|
|
|
SalesforceEventsModule,
|
2025-08-20 18:02:50 +09:00
|
|
|
JobsModule,
|
2025-08-22 17:02:49 +09:00
|
|
|
|
2025-08-30 16:45:22 +09:00
|
|
|
// === FEATURE MODULES ===
|
2025-08-20 18:02:50 +09:00
|
|
|
AuthModule,
|
|
|
|
|
UsersModule,
|
|
|
|
|
MappingsModule,
|
|
|
|
|
CatalogModule,
|
|
|
|
|
OrdersModule,
|
|
|
|
|
InvoicesModule,
|
|
|
|
|
SubscriptionsModule,
|
|
|
|
|
CasesModule,
|
2025-08-30 16:45:22 +09:00
|
|
|
|
|
|
|
|
// === SYSTEM MODULES ===
|
|
|
|
|
HealthModule,
|
|
|
|
|
|
|
|
|
|
// === ROUTING ===
|
|
|
|
|
RouterModule.register(apiRoutes),
|
2025-08-20 18:02:50 +09:00
|
|
|
],
|
|
|
|
|
})
|
2025-09-01 15:11:42 +09:00
|
|
|
export class AppModule {}
|