Files
TREK/server/src/nest/settings/settings.module.ts
T
Maurice 9301053c56 fix(tours): paddle region settings go through the settings service, both values in one transaction
lint:boundaries refused PaddleRegionLoadService injecting the AppSettings repository, which the settings domain owns. SettingsService now reads a registered instance setting (getAppSetting) and writes several of them in one transaction (setAppSettings), and the region load asks it instead.

That also puts the two writes of updateSettings into one transaction, which lint:tx asked for. PLOAD-013 shows that a failed second write leaves the first one unchanged.

load is tagged @txIndependent: it decides one region after the other with Geofabrik asked for a size in between, and a region added or a request filed stands on its own, so no transaction may span it.
2026-10-18 21:35:01 +00:00

35 lines
1.9 KiB
TypeScript

import { AppSettings } from '../../db/entities/AppSettings.entity';
import { Settings } from '../../db/entities/Settings.entity';
import { AppConfigModule } from '../app-config/app-config.module';
import { AuditModule } from '../audit/audit.module';
import { TripMembershipModule } from '../trip-membership/trip-membership.module';
import { AdminDefaultUserSettingsController, SettingsController } from './settings.controller';
import { SettingsMcp } from './settings.mcp';
import { SettingsService } from './settings.service';
import { MikroOrmModule } from '@mikro-orm/nestjs';
import { Module } from '@nestjs/common';
/**
* Exports SettingsService for in-container consumers (admin, share, llm-parse,
* journey, roadtrip, trips, and paddle-obstacles for its instance settings).
*/
@Module({
// MikroOrmModule.forFeature
// registers AppSettingsRepository/SettingsRepository for the
// @InjectRepository(...) constructor params below (Plan 3a Task 0/5) — the
// forFeature + @InjectRepository wiring pattern every later domain copies.
// No `Users` entry: `instance-api-keys.ts`'s repository-backed functions
// take a `UsersRepository` as an explicit parameter from their caller
// (nothing resolves it off an ambient MikroORM request context — an
// earlier design tried that and broke ~185 hand-built unit tests, see
// task-5-review.md §4), so nothing in this module ever needs
// `@InjectRepository(Users)`. TripMembershipModule is here for the planner
// view row (#2639), which keeps only trips the user can still open: the
// trips table belongs to another domain, so the ids come from its service.
imports: [AppConfigModule, AuditModule, TripMembershipModule, MikroOrmModule.forFeature([AppSettings, Settings])],
controllers: [SettingsController, AdminDefaultUserSettingsController],
providers: [SettingsService, SettingsMcp],
exports: [SettingsService],
})
export class SettingsModule {}