Files
TREK/server/src/nest/day-notes/day-notes.module.ts
T
Maurice 1a9855cf70 refactor(mcp): the demo-mode write block runs once, in the registry's tool gate
Every write tool used to open with its own demo check, 196 copies across 30
tool files, most of them injecting AuthService for nothing else. The
registry now takes a toolGate (built from the container) that runs before
each registered tool handler, and TREK's gate refuses a demo account on
every tool not annotated read-only with the same canned result. The
per-tool checks, the AuthService injections, AuthService.isDemoUser and the
AuthModule imports that only fed them are gone; ESLint refuses a demo check
in a tool file, and a registry-wide test calls every write tool as the
demo account.
2026-10-10 20:15:57 +02:00

37 lines
1.8 KiB
TypeScript

import { Module } from '@nestjs/common';
import { MikroOrmModule } from '@mikro-orm/nestjs';
import { DayNotesController } from './day-notes.controller';
import { DayNotesService } from './day-notes.service';
import { DayNotesMcp } from './day-notes.mcp';
import { DayNotesRpc } from './day-notes.rpc';
import { PermissionsModule } from '../permissions/permissions.module';
import { RealtimeModule } from '../realtime/realtime.module';
import { PluginGuardsModule } from '../plugins/host/plugin-guards.module';
import { McpSharedModule } from '../mcp-shared/mcp-shared.module';
import { DayNotes } from '../../db/entities/DayNotes.entity';
import { Days } from '../../db/entities/Days.entity';
import { Trips } from '../../db/entities/Trips.entity';
/**
* Day notes. Its own domain rather than a second file set inside days/, which
* carried two fachlichkeiten with a full controller/service/mcp/rpc/dto each.
*
* Deliberately unconnected to DaysModule in both directions: `dayExists` goes
* through `DaysRepository.existsInTrip` via this module's own `forFeature`
* registration (Plan 4 Task 1), not through `DaysModule`/`DaysService`, and
* `DaysService` reads `day_notes` through its own `DayNotesRepository`
* injection the same way. Wiring the modules to each other would buy
* nothing and cost a cycle.
*
* PluginGuardsModule is only for DayNotesRpc.
*/
@Module({
// DayNotes/Days: Plan 4 Task 1 — DayNotesService's own DayNotesRepository/
// DaysRepository.existsInTrip, replacing its raw `this.dbs.all/get/run`.
imports: [McpSharedModule, PermissionsModule, RealtimeModule, PluginGuardsModule, MikroOrmModule.forFeature([DayNotes, Days, Trips])],
controllers: [DayNotesController],
providers: [DayNotesService, DayNotesMcp, DayNotesRpc],
exports: [DayNotesService],
})
export class DayNotesModule {}