45 lines
1.2 KiB
TypeScript
45 lines
1.2 KiB
TypeScript
import { Controller, Get, Query } from '@nestjs/common';
|
|
import {
|
|
ApiTags,
|
|
ApiOperation,
|
|
ApiBearerAuth,
|
|
ApiQuery,
|
|
} from '@nestjs/swagger';
|
|
import { DashboardService } from '../../application/services/dashboard.service';
|
|
|
|
@ApiTags('Dashboard')
|
|
@ApiBearerAuth()
|
|
@Controller('dashboard')
|
|
export class DashboardController {
|
|
constructor(private readonly dashboardService: DashboardService) {}
|
|
|
|
@Get()
|
|
@ApiOperation({ summary: '获取仪表盘统计数据' })
|
|
async getStats() {
|
|
return this.dashboardService.getDashboardStats();
|
|
}
|
|
|
|
@Get('stats')
|
|
@ApiOperation({ summary: '获取仪表盘统计数据(别名)' })
|
|
async getStatsAlias() {
|
|
return this.dashboardService.getDashboardStats();
|
|
}
|
|
|
|
@Get('realtime')
|
|
@ApiOperation({ summary: '获取实时数据' })
|
|
async getRealtimeStats() {
|
|
return this.dashboardService.getRealtimeStats();
|
|
}
|
|
|
|
@Get('reports')
|
|
@ApiOperation({ summary: '获取每日报表' })
|
|
@ApiQuery({ name: 'page', required: false, type: Number })
|
|
@ApiQuery({ name: 'pageSize', required: false, type: Number })
|
|
async getReports(
|
|
@Query('page') page?: number,
|
|
@Query('pageSize') pageSize?: number,
|
|
) {
|
|
return this.dashboardService.getReports(page ?? 1, pageSize ?? 30);
|
|
}
|
|
}
|