mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-19 05:26:47 +00:00
6763648c45
SettingsRepository (getForUser/upsertForUser/getOne/deleteForUser) replaces the per-user settings table's raw SQL; SettingsService drops DatabaseService entirely. instance-api-keys.ts's readInstanceApiKey/writeInstanceApiKey/ resolveApiKey take an explicit AppSettingsRepository/UsersRepository instead of a raw connection. An earlier version resolved those two repositories itself from the active MikroORM request context, so none of its six callers needed to change. That worked in production and e2e (always inside a real request) but broke service construction in plain unit tests across every calling domain (addons, auth x2, maps, transit, unsplash - 185 failures on a full run), since none of them wrap a request context. Each of those six services now injects its own AppSettingsRepository/UsersRepository and passes them through explicitly, matching how every other converted repository in this migration is consumed; their own SQL is untouched (outside Plan 3a).
29 lines
1.3 KiB
TypeScript
29 lines
1.3 KiB
TypeScript
import { Module } from '@nestjs/common';
|
|
import { MikroOrmModule } from '@mikro-orm/nestjs';
|
|
import { MapsController } from './maps.controller';
|
|
import { MapsService } from './maps.service';
|
|
import { MapsMcp } from './maps.mcp';
|
|
import { PlacePhotosModule } from '../place-photos/place-photos.module';
|
|
import { StorageModule } from '../storage/storage.module';
|
|
import { AppSettings } from '../../db/entities/AppSettings.entity';
|
|
import { Users } from '../../db/entities/Users.entity';
|
|
|
|
/**
|
|
* Maps / geo domain (L3 leaf module). Registered in AppModule. Exports
|
|
* MapsService for the in-container consumers (BookingImportModule's Nominatim
|
|
* geocoding, PlacesModule's search_place tool and list-import enrichment).
|
|
* Nothing outside the container consumes this domain, so there is no bridge.
|
|
*
|
|
* MikroOrmModule.forFeature([AppSettings, Users]): MapsService passes its own
|
|
* AppSettingsRepository/UsersRepository to instance-api-keys.ts's
|
|
* resolveApiKey now (Plan 3a Task 5) — every other read here is still raw SQL
|
|
* through DatabaseService (maps is outside Plan 3a).
|
|
*/
|
|
@Module({
|
|
imports: [PlacePhotosModule, StorageModule, MikroOrmModule.forFeature([AppSettings, Users])],
|
|
controllers: [MapsController],
|
|
providers: [MapsService, MapsMcp],
|
|
exports: [MapsService],
|
|
})
|
|
export class MapsModule {}
|