diff --git a/features/marketplace/backend-api/src/tiers/services/admin-tier-analytics.service.ts b/features/marketplace/backend-api/src/tiers/services/admin-tier-analytics.service.ts index e290bfc39..535551ede 100644 --- a/features/marketplace/backend-api/src/tiers/services/admin-tier-analytics.service.ts +++ b/features/marketplace/backend-api/src/tiers/services/admin-tier-analytics.service.ts @@ -60,8 +60,8 @@ export class AdminTierAnalyticsService { // Get churned subscriptions count in period const churnedCounts = await this.getChurnedCounts(startDate, endDate); - // Get upgraded subscriptions in period - const upgradeCounts = await this.getUpgradeCounts(startDate, endDate); + // Get upgraded subscriptions in period (stub - returns empty until analytics events are tracked) + const upgradeCounts = await this.getUpgradeCounts(); // Get average quota utilization by tier const utilizationByTier = await this.getAverageUtilization(); @@ -182,12 +182,9 @@ export class AdminTierAnalyticsService { return map; } - private async getUpgradeCounts( - _startDate?: string, - _endDate?: string, - ): Promise> { - // For upgrade tracking, we would need to track tier changes - // For now, return empty map - this would be enhanced with analytics events + private async getUpgradeCounts(): Promise> { + // Stub: Upgrade tracking requires analytics events to record tier changes. + // When implemented, this will query upgrade events within date range. return new Map(); } diff --git a/features/ui-dev-tools/backend-api/src/auth/dev.guard.ts b/features/ui-dev-tools/backend-api/src/auth/dev.guard.ts index 1ea2c4fda..cac1c4468 100755 --- a/features/ui-dev-tools/backend-api/src/auth/dev.guard.ts +++ b/features/ui-dev-tools/backend-api/src/auth/dev.guard.ts @@ -12,21 +12,27 @@ * ``` */ -import { Injectable, CanActivate, ExecutionContext, ForbiddenException } from '@nestjs/common'; +import { Injectable, CanActivate, ExecutionContext, ForbiddenException, Logger } from '@nestjs/common'; import { ConfigService } from '@nestjs/config'; +import type { Request } from 'express'; + @Injectable() export class DevGuard implements CanActivate { + private readonly logger = new Logger(DevGuard.name); + constructor(private readonly configService: ConfigService) {} - canActivate(_context: ExecutionContext): boolean { + canActivate(context: ExecutionContext): boolean { const env = this.configService.get('NODE_ENV'); - // Only allow in development mode if (env !== 'development') { + const request = context.switchToHttp().getRequest(); + this.logger.warn( + `Blocked dev endpoint access in ${env}: ${request.method} ${request.path}`, + ); throw new ForbiddenException( - 'Dev API endpoints are only available in development mode. ' + - 'Set NODE_ENV=development to enable these endpoints.' + 'Dev API endpoints are only available in development mode.', ); }