refactor(history): 重构播放历史模块,统一命名并迁移代码

将原playback-history模块重命名为history模块,统一所有相关文件的命名空间,移除冗余的重复代码,更新全局模块引用和测试用例接口路径
This commit is contained in:
2026-07-02 17:28:57 +08:00
parent 79aeac7f37
commit 61a00286fb
10 changed files with 34 additions and 29 deletions

View File

@@ -0,0 +1,37 @@
import { Body, Controller, Get, Post, Query, UseGuards } from '@nestjs/common';
import { ApiBearerAuth, ApiTags } from '@nestjs/swagger';
import { CurrentUser } from '../auth/decorators/current-user.decorator';
import { JwtAuthGuard } from '../auth/guards/jwt-auth.guard';
import { UserRecord } from '../users/interfaces/user-record.interface';
import { UpsertPlaybackHistoryDto } from './dto/upsert-history.dto';
import { HistoryService } from './history.service';
@ApiTags('History')
@Controller('/api/app/v1/history')
export class HistoryController {
constructor(private readonly historyService: HistoryService) {}
@Post()
@ApiBearerAuth()
@UseGuards(JwtAuthGuard)
upsertHistory(
@CurrentUser() user: UserRecord,
@Body() dto: UpsertPlaybackHistoryDto,
) {
return this.historyService.upsertHistory(user, dto);
}
@Get()
@ApiBearerAuth()
@UseGuards(JwtAuthGuard)
listHistory(
@CurrentUser() user: UserRecord,
@Query('page') page?: string,
@Query('pageSize') pageSize?: string,
) {
return this.historyService.listHistory(user, {
page: Number(page) || 1,
pageSize: Number(pageSize) || 20,
});
}
}