mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 14:38:12 +00:00
feat(passenger-api): integrate @tria-plc IAM package (dual-ORM iam schema + package auth guard)
This commit is contained in:
@@ -1,13 +1,17 @@
|
||||
import { Module, NestModule, MiddlewareConsumer } from '@nestjs/common';
|
||||
import { ConfigModule } from '@nestjs/config';
|
||||
import { ConfigModule, ConfigService } from '@nestjs/config';
|
||||
import { ScheduleModule } from '@nestjs/schedule';
|
||||
import { EventEmitterModule } from '@nestjs/event-emitter';
|
||||
import { TypeOrmModule, TypeOrmModuleOptions } from '@nestjs/typeorm';
|
||||
// Subpath import: the @tria-plc/iamapi-common barrel does not resolve under moduleResolution:"Node".
|
||||
// Aliased to avoid clashing with the app's existing custom ./common/iam.module (remote IamGuard).
|
||||
import { IamModule as TriaIamModule } from '@tria-plc/iamapi-common/iam.module';
|
||||
import { PrismaModule } from './common/prisma.module';
|
||||
import { I18nModule } from './common/i18n/i18n.module';
|
||||
import { IamModule } from './common/iam.module';
|
||||
import { LocaleMiddleware } from './common/i18n/locale.middleware';
|
||||
import appConfig from './config/app.config';
|
||||
import dbConfig from './config/database.config';
|
||||
import iamDatabaseConfig from './config/iam-database.config';
|
||||
import telebirrConfig from './config/telebirr.config';
|
||||
import cbeConfig from './config/cbe.config';
|
||||
import ebirrConfig from './config/ebirr.config';
|
||||
@@ -46,6 +50,7 @@ import { VerifaydaModule } from './modules/verifayda/verifayda.module';
|
||||
load: [
|
||||
appConfig,
|
||||
dbConfig,
|
||||
iamDatabaseConfig,
|
||||
telebirrConfig,
|
||||
cbeConfig,
|
||||
ebirrConfig,
|
||||
@@ -56,10 +61,22 @@ import { VerifaydaModule } from './modules/verifayda/verifayda.module';
|
||||
}),
|
||||
ScheduleModule.forRoot(),
|
||||
EventEmitterModule.forRoot(),
|
||||
// TypeORM root DataSource for the shared `iam` schema (coexists with Prisma's `passenger`
|
||||
// schema). Required so @tria-plc/api-common's JwtGuard can read `iam.sessions`, and so
|
||||
// IamModule's forFeature repositories resolve. Options come from the `database` config
|
||||
// namespace (see config/database.config.ts → iam-typeorm.config.ts).
|
||||
TypeOrmModule.forRootAsync({
|
||||
inject: [ConfigService],
|
||||
useFactory: (config: ConfigService): TypeOrmModuleOptions =>
|
||||
config.get<TypeOrmModuleOptions>('iamDatabase')!,
|
||||
}),
|
||||
// Mount the @tria-plc IAM module (auth/user/org-structure). Registers the IAM REST API under
|
||||
// /v1/* (URI versioning). NOTE: SharedAuthModule (global JwtGuard) is intentionally added later
|
||||
// in the route-protection phase, so public passenger routes are not 401'd before then.
|
||||
TriaIamModule.forRoot(),
|
||||
PrismaModule,
|
||||
I18nModule,
|
||||
IamModule,
|
||||
AuthModule,
|
||||
// AuthModule,
|
||||
StationsModule,
|
||||
FleetModule,
|
||||
SchedulesModule,
|
||||
|
||||
Reference in New Issue
Block a user