mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-18 21:16:47 +00:00
f3e5be78c9
Folds the legacy services/fileService.ts into the DI-native FilesService (injected DatabaseService, byte-identical SQL). Load-time constants move to files.constants.ts; files.bridge.ts survives with a single export for the request-time getAllowedExtensions read the module-scope multer configs need outside DI. TripsService and PluginHostDepsFactory inject FilesService. Also rides the nestjs-zod ratchet (FileUploadDto/FileUpdateDto/FileLinkDto over the @trek/shared contracts, FilesController entries dropped from the body-contract allow-list) and fixes the verified legacy quirks: file-link insert failures now surface instead of being swallowed, updateFile coerces an empty-string description to NULL like createFile, and formatFile's misleading optional trip_id annotation is gone.
45 lines
2.2 KiB
TypeScript
45 lines
2.2 KiB
TypeScript
import { DatabaseService } from '../../src/nest/database/database.service';
|
|
import { PluginRuntimeService } from '../../src/nest/plugins/plugin-runtime.service';
|
|
import type { PluginRegistryService } from '../../src/nest/plugins/registry/registry.service';
|
|
import { PluginHostDepsFactory } from '../../src/nest/plugins/host/plugin-host-deps.factory';
|
|
import { PluginOAuthService } from '../../src/nest/plugins/plugin-oauth.service';
|
|
import { BudgetService } from '../../src/nest/budget/budget.service';
|
|
import { ReservationsService } from '../../src/nest/reservations/reservations.service';
|
|
import { TagsService } from '../../src/nest/tags/tags.service';
|
|
import { CategoriesService } from '../../src/nest/categories/categories.service';
|
|
import { TodoService } from '../../src/nest/todo/todo.service';
|
|
import { PackingService } from '../../src/nest/packing/packing.service';
|
|
import { DayNotesService } from '../../src/nest/days/day-notes.service';
|
|
import { AssignmentsService } from '../../src/nest/assignments/assignments.service';
|
|
import { LlmConfigResolver } from '../../src/nest/llm-parse/llm-config.resolver';
|
|
import { SettingsService } from '../../src/nest/settings/settings.service';
|
|
import { FilesService } from '../../src/nest/files/files.service';
|
|
|
|
/**
|
|
* Hand-wired counterpart of the PluginsModule DI graph for no-Nest tests
|
|
* (same pattern as mcp-test-controllers.ts): real domain services over the
|
|
* test DB, so runtime tests exercise the same wiring production gets from
|
|
* the container.
|
|
*/
|
|
export function createHostDepsFactory(dbs: DatabaseService): PluginHostDepsFactory {
|
|
return new PluginHostDepsFactory(
|
|
new BudgetService(dbs),
|
|
new ReservationsService(dbs),
|
|
new TagsService(dbs),
|
|
new CategoriesService(dbs),
|
|
new TodoService(dbs),
|
|
new PackingService(dbs),
|
|
new PluginOAuthService(dbs),
|
|
new DayNotesService(dbs),
|
|
new AssignmentsService(dbs),
|
|
new LlmConfigResolver(new SettingsService(dbs), dbs),
|
|
dbs,
|
|
new FilesService(dbs),
|
|
);
|
|
}
|
|
|
|
/** A PluginRuntimeService constructed the way Nest would: with a real host-deps factory. */
|
|
export function createPluginRuntime(dbs: DatabaseService, registry?: PluginRegistryService): PluginRuntimeService {
|
|
return new PluginRuntimeService(dbs, registry, createHostDepsFactory(dbs));
|
|
}
|