mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-23 15:36:33 +00:00
b658b5e68d
DatabaseBackupModule stays @Global, but its comment gave a vague reason. The real one is concrete: the backup domain already reaches admin through auth and settings, so importing the module from AdminModule would add a domain cycle that lint:boundaries rejects. The module comment now says that and points at the e2e harness that imports it by hand, and AdminModule notes where its DATABASE_BACKUP comes from.
27 lines
1.3 KiB
TypeScript
27 lines
1.3 KiB
TypeScript
import { Global, Module } from '@nestjs/common';
|
|
import { DATABASE_BACKUP } from '../database/database-backup.interface';
|
|
import { DatabaseLifecycleModule } from '../database/database-lifecycle.module';
|
|
import { MaintenanceModule } from '../database/maintenance.module';
|
|
import { SqliteDatabaseBackup } from './sqlite-database-backup';
|
|
|
|
/**
|
|
* Binds the database backup port (`DATABASE_BACKUP`) to the engine in use.
|
|
*
|
|
* Global because its consumers sit in two domains: the backup domain itself
|
|
* and the admin domain (the demo reset job and the baseline route). Admin
|
|
* cannot import this file. The backup domain already reaches admin (backup
|
|
* imports auth, auth imports settings, settings imports admin), so an
|
|
* `admin -> backup` import would close a new domain cycle that
|
|
* `lint:boundaries` refuses. Both inject the token from the shared database
|
|
* kernel instead. `BackupModule` imports this module, which is what puts it in
|
|
* the application; a test harness that mounts `AdminModule` without
|
|
* `BackupModule` imports it itself (tests/e2e/admin.e2e.test.ts).
|
|
*/
|
|
@Global()
|
|
@Module({
|
|
imports: [DatabaseLifecycleModule, MaintenanceModule],
|
|
providers: [SqliteDatabaseBackup, { provide: DATABASE_BACKUP, useExisting: SqliteDatabaseBackup }],
|
|
exports: [DATABASE_BACKUP],
|
|
})
|
|
export class DatabaseBackupModule {}
|