feat: implement lazy loading for data service and enhance service registration (#233)

This commit is contained in:
samanhappy
2025-07-20 21:37:43 +08:00
committed by GitHub
parent b0b0c93337
commit 0f00ad7200
4 changed files with 45 additions and 9 deletions

View File

@@ -13,6 +13,7 @@ import {
} from './services/sseService.js';
import { initializeDefaultUser } from './models/User.js';
import { sseUserContextMiddleware } from './middlewares/userContext.js';
import { initializeServices } from './services/services.js';
// Get the current working directory (will be project root in most cases)
const currentFileDir = process.cwd() + '/src';
@@ -31,6 +32,9 @@ export class AppServer {
async initialize(): Promise<void> {
try {
// Initialize services
await initializeServices();
// Initialize default admin user if no users exist
await initializeDefaultUser();