fix issues
This commit is contained in:
@@ -76,6 +76,7 @@ export class DemoLoginUseCase implements UseCase<DemoLoginInput, void, DemoLogin
|
|||||||
const passwordHashModule = await import('@core/identity/domain/value-objects/PasswordHash');
|
const passwordHashModule = await import('@core/identity/domain/value-objects/PasswordHash');
|
||||||
const passwordHash = passwordHashModule.PasswordHash.fromHash(hashedPassword);
|
const passwordHash = passwordHashModule.PasswordHash.fromHash(hashedPassword);
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
const userProps: any = {
|
const userProps: any = {
|
||||||
id: userId,
|
id: userId,
|
||||||
displayName: config.name,
|
displayName: config.name,
|
||||||
|
|||||||
@@ -6,9 +6,6 @@ import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
|
|||||||
import { writeFileSync } from 'fs';
|
import { writeFileSync } from 'fs';
|
||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
import { AppModule } from './app.module';
|
import { AppModule } from './app.module';
|
||||||
import { AuthenticationGuard } from './domain/auth/AuthenticationGuard';
|
|
||||||
import { AuthorizationGuard } from './domain/auth/AuthorizationGuard';
|
|
||||||
import { FeatureAvailabilityGuard } from './domain/policy/FeatureAvailabilityGuard';
|
|
||||||
import { getGenerateOpenapi } from './env';
|
import { getGenerateOpenapi } from './env';
|
||||||
|
|
||||||
async function bootstrap() {
|
async function bootstrap() {
|
||||||
@@ -65,9 +62,8 @@ async function bootstrap() {
|
|||||||
.addTag('analytics', 'Analytics and reporting endpoints')
|
.addTag('analytics', 'Analytics and reporting endpoints')
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
const document = SwaggerModule.createDocument(app, config);
|
||||||
const document = SwaggerModule.createDocument(app as any, config);
|
SwaggerModule.setup('api/docs', app, document);
|
||||||
SwaggerModule.setup('api/docs', app as any, document);
|
|
||||||
|
|
||||||
// OpenAPI export
|
// OpenAPI export
|
||||||
if (generateOpenapi) {
|
if (generateOpenapi) {
|
||||||
@@ -83,8 +79,8 @@ async function bootstrap() {
|
|||||||
await app.listen(3000);
|
await app.listen(3000);
|
||||||
console.log('✅ API Server started successfully on port 3000');
|
console.log('✅ API Server started successfully on port 3000');
|
||||||
console.log('📚 Swagger docs: http://localhost:3000/api/docs');
|
console.log('📚 Swagger docs: http://localhost:3000/api/docs');
|
||||||
} catch (error: any) {
|
} catch (error: unknown) {
|
||||||
console.error('❌ Failed to start API server:', error.message);
|
console.error('❌ Failed to start API server:', error instanceof Error ? error.message : 'Unknown error');
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -95,8 +91,8 @@ process.on('uncaughtException', (error) => {
|
|||||||
process.exit(1);
|
process.exit(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
process.on('unhandledRejection', (reason: any) => {
|
process.on('unhandledRejection', (reason: unknown) => {
|
||||||
console.error('🚨 Unhandled Rejection:', reason?.message || reason);
|
console.error('🚨 Unhandled Rejection:', reason instanceof Error ? reason.message : reason);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
24
apps/api/src/shared/logging/InitializationLogger.ts
Normal file
24
apps/api/src/shared/logging/InitializationLogger.ts
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
export class InitializationLogger {
|
||||||
|
private static instance: InitializationLogger;
|
||||||
|
|
||||||
|
private constructor() {}
|
||||||
|
|
||||||
|
static getInstance(): InitializationLogger {
|
||||||
|
if (!InitializationLogger.instance) {
|
||||||
|
InitializationLogger.instance = new InitializationLogger();
|
||||||
|
}
|
||||||
|
return InitializationLogger.instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
log(message: string): void {
|
||||||
|
console.log(`[Initialization] ${message}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
error(message: string): void {
|
||||||
|
console.error(`[Initialization] ${message}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
warn(message: string): void {
|
||||||
|
console.warn(`[Initialization] ${message}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
7
apps/api/src/shared/logging/LoggedProvider.ts
Normal file
7
apps/api/src/shared/logging/LoggedProvider.ts
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import { Provider } from '@nestjs/common';
|
||||||
|
import { InitializationLogger } from './InitializationLogger';
|
||||||
|
|
||||||
|
export function createLoggedProviders(providers: Provider[], logger: InitializationLogger): Provider[] {
|
||||||
|
logger.log(`Creating ${providers.length} providers`);
|
||||||
|
return providers;
|
||||||
|
}
|
||||||
@@ -106,9 +106,12 @@ export class EnhancedErrorReporter implements ErrorReporter {
|
|||||||
const severity = error.getSeverity();
|
const severity = error.getSeverity();
|
||||||
|
|
||||||
const message = isDev ? error.getDeveloperMessage() : error.getUserMessage();
|
const message = isDev ? error.getDeveloperMessage() : error.getUserMessage();
|
||||||
|
const contextObj = typeof context === 'object' && context !== null ? context : {};
|
||||||
|
const errorContextObj = typeof error.context === 'object' && error.context !== null ? error.context : {};
|
||||||
|
|
||||||
const logContext = {
|
const logContext = {
|
||||||
...error.context,
|
...errorContextObj,
|
||||||
...context,
|
...contextObj,
|
||||||
type: error.type,
|
type: error.type,
|
||||||
isRetryable: error.isRetryable(),
|
isRetryable: error.isRetryable(),
|
||||||
isConnectivity: error.isConnectivityIssue(),
|
isConnectivity: error.isConnectivityIssue(),
|
||||||
|
|||||||
Reference in New Issue
Block a user