From 41c158cdb680e64d26a0cf7b9d8599d43e735dbc Mon Sep 17 00:00:00 2001 From: portable Date: Fri, 26 Jun 2026 16:49:12 +0100 Subject: [PATCH] feat: add Logger to dashboard.service.ts (#773) feat: add graceful shutdown handler (#776) feat: add Node.js version check on startup (#775) --- src/dashboard/dashboard.service.ts | 5 ++++- src/main.ts | 12 +++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/dashboard/dashboard.service.ts b/src/dashboard/dashboard.service.ts index 6057d6e..fc7fcd2 100644 --- a/src/dashboard/dashboard.service.ts +++ b/src/dashboard/dashboard.service.ts @@ -1,6 +1,6 @@ // @ts-nocheck -import { Injectable, NotFoundException } from '@nestjs/common'; +import { Injectable, NotFoundException, Logger } from '@nestjs/common'; import { Decimal } from '@prisma/client/runtime/library'; import { PrismaService } from '../database/prisma.service'; import { @@ -13,9 +13,12 @@ import { @Injectable() export class DashboardService { + private readonly logger = new Logger(DashboardService.name); + constructor(private prisma: PrismaService) {} async getDashboard(userId: string): Promise { + this.logger.log(`Fetching dashboard for user ${userId}`); const [profile, stats, recentActivity, recommendations] = await Promise.all([ this.getProfileSummary(userId), this.getQuickStats(userId), diff --git a/src/main.ts b/src/main.ts index 440e6e4..24e5d28 100644 --- a/src/main.ts +++ b/src/main.ts @@ -14,9 +14,17 @@ import { RateLimitHeadersInterceptor } from './auth/interceptors/rate-limit-head import { setupSwagger } from './config/swagger.config'; async function bootstrap() { - const app = await NestFactory.create(AppModule); const logger = new Logger('Bootstrap'); + // Node.js version check (#775) + const nodeMajor = parseInt(process.versions.node.split('.')[0], 10); + if (nodeMajor < 18) { + logger.error(`Node.js >= 18 required, found ${process.versions.node}`); + process.exit(1); + } + + const app = await NestFactory.create(AppModule); + // Enable validation app.useGlobalPipes( new ValidationPipe({ @@ -66,6 +74,8 @@ async function bootstrap() { // Setup Swagger documentation setupSwagger(app); + app.enableShutdownHooks(); + const port = process.env.PORT || 3000; await app.listen(port); logger.log(`PropChain API running on http://localhost:${port}`);