league service

This commit is contained in:
2025-12-16 00:57:31 +01:00
parent 3b566c973d
commit 775d41e055
130 changed files with 4077 additions and 1036 deletions

View File

@@ -0,0 +1,25 @@
import { NestFactory } from '@nestjs/core';
import { INestApplicationContext } from '@nestjs/common';
import { AppModule } from './app.module';
let appContext: INestApplicationContext | null = null;
export async function initializeDIContainer(): Promise<void> {
if (appContext) {
return; // Already initialized
}
appContext = await NestFactory.createApplicationContext(AppModule);
}
export function getDIContainer(): INestApplicationContext {
if (!appContext) {
throw new Error('DI container not initialized. Call initializeDIContainer() first.');
}
return appContext;
}
export async function getService<T>(token: string | symbol): Promise<T> {
const container = getDIContainer();
return container.get<T>(token);
}