Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | import { Controller, Get, Param, Query } from '@nestjs/common'; import { SaaSAnalyticsService } from './analytics.service'; import { ApiTags, ApiOperation, ApiResponse } from '@nestjs/swagger'; @ApiTags('SaaS Analytics') @Controller('api/v1/admin/dashboard/summary') export class SaaSAnalyticsController { constructor(private readonly analyticsService: SaaSAnalyticsService) {} @Get() @ApiOperation({ summary: 'Get historical SaaS metrics' }) @ApiResponse({ status: 200, description: 'Operation successful' }) async getHistoricalMetrics(@Query('limit') limit?: number) { const historical = await this.analyticsService.getHistoricalMetrics( limit || 12, ); return { success: true, data: historical, }; } @Get(':monthKey') @ApiOperation({ summary: 'Get SaaS metrics for a specific month (e.g. 2026-07)', }) @ApiResponse({ status: 200, description: 'Operation successful' }) async getMetricsByMonth(@Param('monthKey') monthKey: string) { const data = await this.analyticsService.getMetrics(monthKey); return { success: true, data: data || null, }; } } |