import { Controller, Get, UseGuards } from '@nestjs/common';
import { AnalyticsService } from './analytics.service';
import { DashboardService } from './dashboard.service';
import { AuthGuard } from '../auth/auth.guard';
import { CurrentUser } from '../auth/auth.decorator';
@Controller('analytics')
@UseGuards(AuthGuard)
export class AnalyticsController {
constructor(
private readonly analyticsService: AnalyticsService,
private readonly dashboardService: DashboardService,
) {}
@Get('dashboard') async getDashboard(@CurrentUser('userId') userId: string) {
return this.dashboardService.getDashboard(userId);
}
@Get('reports/sales') async getSalesReport(@CurrentUser('userId') userId: string) {
return this.analyticsService.getSellerDashboard(userId);
}
}