2026-05-09 18:25:04 +08:00
|
|
|
import { Controller, Get } from '@nestjs/common';
|
|
|
|
|
import { ApiTags, ApiOperation } from '@nestjs/swagger';
|
|
|
|
|
import { LearningActivityService } from './learning-activity.service';
|
2026-05-17 00:39:46 +08:00
|
|
|
import { CurrentUser } from '../../common/decorators/current-user.decorator';
|
|
|
|
|
import type { UserPayload } from '../../common/types';
|
2026-05-09 18:25:04 +08:00
|
|
|
|
|
|
|
|
@ApiTags('learning-activity')
|
|
|
|
|
@Controller('activity')
|
|
|
|
|
export class LearningActivityController {
|
|
|
|
|
constructor(private readonly activityService: LearningActivityService) {}
|
|
|
|
|
|
|
|
|
|
@Get('heatmap')
|
|
|
|
|
@ApiOperation({ summary: '获取学习热力图数据' })
|
2026-05-17 00:39:46 +08:00
|
|
|
async getHeatmap(@CurrentUser() user: UserPayload) {
|
|
|
|
|
return this.activityService.getHeatmap(String(user?.id || 'anonymous'));
|
2026-05-09 18:25:04 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Get('summary')
|
|
|
|
|
@ApiOperation({ summary: '获取学习统计概览' })
|
2026-05-17 00:39:46 +08:00
|
|
|
async getSummary(@CurrentUser() user: UserPayload) {
|
|
|
|
|
return this.activityService.getSummary(String(user?.id || 'anonymous'));
|
2026-05-09 18:25:04 +08:00
|
|
|
}
|
|
|
|
|
}
|