ceo-api/src/app.module.ts
valentinbvro 722113a359 feat: scaffold Identity Engine (CASL/tenant guard) and Event Fabric (outbox)
Adds tenants/memberships/consent_records tables, a CASL AbilityFactory
keyed on membership role, and a TenantGuard that derives tenant_id from
session only (never client-supplied), per blueprint 8.2/8.3/11.3.

Adds outbox_events + audit_log tables, an OutboxService for transactional
writes, and a Cron-based OutboxDispatcher that publishes pending events
to a BullMQ queue, per blueprint 9.1 (events before intelligence).
2026-07-21 02:46:35 +02:00

35 lines
1.1 KiB
TypeScript

import { Module } from '@nestjs/common';
import { ConfigModule } from '@nestjs/config';
import { ThrottlerModule } from '@nestjs/throttler';
import { ScheduleModule } from '@nestjs/schedule';
import { BullModule } from '@nestjs/bullmq';
import { LoggerModule } from 'nestjs-pino';
import { HealthController } from './health/health.controller';
import { AuthModule } from './auth/auth.module';
import { EventsModule } from './events/events.module';
function parseRedisConnection(redisUrl: string | undefined) {
if (!redisUrl) {
return { host: 'localhost', port: 6379 };
}
const url = new URL(redisUrl);
return {
host: url.hostname,
port: Number(url.port || 6379),
password: url.password || undefined,
};
}
@Module({
imports: [
ConfigModule.forRoot({ isGlobal: true }),
LoggerModule.forRoot(),
ThrottlerModule.forRoot([{ ttl: 60000, limit: 100 }]),
ScheduleModule.forRoot(),
BullModule.forRoot({ connection: parseRedisConnection(process.env.REDIS_URL) }),
AuthModule,
EventsModule,
],
controllers: [HealthController],
})
export class AppModule {}