mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-27 15:17:30 +00:00
cc79f561e5
JwtAuthGuard, OptionalJwtAuthGuard, CookieAuthGuard, AdminGuard, the global and MFA guards, @CurrentUser, @Public, JWT verification and the ephemeral token service lived in the auth domain, so every controller that checked a session depended on the whole account module and its imports. They import no domain themselves; under src/nest/auth-core they are shared kernel like common/, every importer points there directly, and AtlasModule and NotificationsModule stop importing AuthModule, which they only did for the demo gate. lint:boundaries counts auth-core as kernel: 57 fewer cyclic domain edges, the largest cycle shrinks from 46 to 40 domains.
64 lines
3.5 KiB
TypeScript
64 lines
3.5 KiB
TypeScript
import { Module } from '@nestjs/common';
|
|
import { MikroOrmModule } from '@mikro-orm/nestjs';
|
|
import { FilesController } from './files.controller';
|
|
import { FilesDownloadController } from './files-download.controller';
|
|
import { FilesService } from './files.service';
|
|
import { FilesRpc } from './files.rpc';
|
|
import { FilesMcp } from './files.mcp';
|
|
import { McpSharedModule } from '../mcp-shared/mcp-shared.module';
|
|
import { PluginGuardsModule } from '../plugins/host/plugin-guards.module';
|
|
import { RealtimeModule } from '../realtime/realtime.module';
|
|
import { PermissionsModule } from '../permissions/permissions.module';
|
|
import { AppConfigModule } from '../app-config/app-config.module';
|
|
import { EphemeralTokenModule } from '../auth-core/ephemeral-token.module';
|
|
import { MulterModule } from '@nestjs/platform-express';
|
|
import { AllowedFileTypesModule } from './allowed-file-types.module';
|
|
import { AllowedFileTypesService } from './allowed-file-types.service';
|
|
import { StorageModule } from '../storage/storage.module';
|
|
import { StorageService } from '../storage/storage.service';
|
|
import { buildStorageUploadOptions } from '../storage/storage-upload.factory';
|
|
import { filesUploadFileFilter } from './files.controller';
|
|
import { MAX_FILE_SIZE, MAX_VIDEO_SIZE } from './files.constants';
|
|
import { TripFiles } from '../../db/entities/TripFiles.entity';
|
|
import { FileLinks } from '../../db/entities/FileLinks.entity';
|
|
import { Reservations } from '../../db/entities/Reservations.entity';
|
|
import { Places } from '../../db/entities/Places.entity';
|
|
import { DayAssignments } from '../../db/entities/DayAssignments.entity';
|
|
import { BudgetItems } from '../../db/entities/BudgetItems.entity';
|
|
import { Users } from '../../db/entities/Users.entity';
|
|
import { Trips } from '../../db/entities/Trips.entity';
|
|
|
|
@Module({
|
|
imports: [
|
|
MulterModule.registerAsync({
|
|
imports: [StorageModule, AllowedFileTypesModule],
|
|
inject: [StorageService, AllowedFileTypesService],
|
|
useFactory: (storage: StorageService, allowedTypes: AllowedFileTypesService) =>
|
|
buildStorageUploadOptions(storage, {
|
|
category: 'files',
|
|
// Allow up to the video cap; non-video files are still held to
|
|
// MAX_FILE_SIZE by the per-type guard in the upload handler (#823).
|
|
// An operator may raise the document limit past the video cap.
|
|
maxSize: Math.max(MAX_VIDEO_SIZE, MAX_FILE_SIZE),
|
|
defParamCharset: 'utf8', // parity with legacy routes/files.ts — preserve non-ASCII original filenames
|
|
fileFilter: filesUploadFileFilter(allowedTypes),
|
|
}),
|
|
}),
|
|
StorageModule,
|
|
// TripFiles/FileLinks are this domain's own tables (Plan 3e Task 1).
|
|
// Reservations/Places/DayAssignments/BudgetItems/Users are owned
|
|
// elsewhere — registered here only for `findForeignLinkTarget`'s
|
|
// `findTripId` reads and FL28's `UsersRepository.getEmail` (the entity
|
|
// classes only, never the owning module — the `AccommodationsDomainModule`
|
|
// precedent).
|
|
MikroOrmModule.forFeature([TripFiles, FileLinks, Reservations, Places, DayAssignments, BudgetItems, Users, Trips]),
|
|
// McpSharedModule feeds FilesMcp's RBAC guards; it is not @Global.
|
|
EphemeralTokenModule, PermissionsModule, AppConfigModule, RealtimeModule, PluginGuardsModule, McpSharedModule,
|
|
// FilesMcp's upload tool checks the same extension list as the multipart filter.
|
|
AllowedFileTypesModule],
|
|
controllers: [FilesController, FilesDownloadController],
|
|
providers: [FilesService, FilesRpc, FilesMcp],
|
|
exports: [FilesService],
|
|
})
|
|
export class FilesModule {}
|