forked from gongxuegit/tiku-backend.net
feat: migrate direct tenant content and learning endpoints
This commit is contained in:
@@ -15,6 +15,34 @@ public sealed class LearningController(
|
||||
ICurrentUser currentUser,
|
||||
ICurrentTenant currentTenant) : ControllerBase
|
||||
{
|
||||
[HttpGet("stats")]
|
||||
[EndpointSummary("查询学习统计")]
|
||||
[ProducesResponseType<LearningStatsItem>(StatusCodes.Status200OK)]
|
||||
public async Task<ActionResult<LearningStatsItem>> GetStats(CancellationToken cancellationToken)
|
||||
{
|
||||
return Ok(await learningActivityService.GetStatsAsync(ResolveActor(), cancellationToken));
|
||||
}
|
||||
|
||||
[HttpGet("trend")]
|
||||
[EndpointSummary("查询学习趋势")]
|
||||
[ProducesResponseType<LearningList<LearningTrendItem>>(StatusCodes.Status200OK)]
|
||||
public async Task<ActionResult<LearningList<LearningTrendItem>>> GetTrend(
|
||||
[FromQuery] LearningLimitQueryDto query,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
return Ok(await learningActivityService.GetTrendAsync(ResolveActor(), query.ToFilter(), cancellationToken));
|
||||
}
|
||||
|
||||
[HttpGet("leaderboard")]
|
||||
[EndpointSummary("查询学习排行榜")]
|
||||
[ProducesResponseType<LearningLeaderboardResult>(StatusCodes.Status200OK)]
|
||||
public async Task<ActionResult<LearningLeaderboardResult>> GetLeaderboard(
|
||||
[FromQuery] LearningLimitQueryDto query,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
return Ok(await learningActivityService.GetLeaderboardAsync(ResolveActor(), query.ToFilter(), cancellationToken));
|
||||
}
|
||||
|
||||
[HttpPost("practice-sessions")]
|
||||
[EndpointSummary("创建练习会话")]
|
||||
[ProducesResponseType<PracticeSessionItem>(StatusCodes.Status200OK)]
|
||||
@@ -153,6 +181,19 @@ public sealed class LearningController(
|
||||
cancellationToken));
|
||||
}
|
||||
|
||||
[HttpGet("wrong-questions/review-plan")]
|
||||
[EndpointSummary("生成错题复习计划")]
|
||||
[ProducesResponseType<WrongQuestionReviewPlan>(StatusCodes.Status200OK)]
|
||||
public async Task<ActionResult<WrongQuestionReviewPlan>> GetWrongQuestionReviewPlan(
|
||||
[FromQuery] LearningLimitQueryDto query,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
return Ok(await learningActivityService.GetWrongQuestionReviewPlanAsync(
|
||||
ResolveActor(),
|
||||
query.ToFilter(),
|
||||
cancellationToken));
|
||||
}
|
||||
|
||||
[HttpPost("wrong-questions/resolve")]
|
||||
[EndpointSummary("将错题标记为已解决")]
|
||||
[ProducesResponseType<LearningActionResult>(StatusCodes.Status200OK)]
|
||||
@@ -180,6 +221,19 @@ public sealed class LearningController(
|
||||
cancellationToken));
|
||||
}
|
||||
|
||||
[HttpGet("vocabulary/review-plan")]
|
||||
[EndpointSummary("生成单词复习计划")]
|
||||
[ProducesResponseType<WordReviewPlan>(StatusCodes.Status200OK)]
|
||||
public async Task<ActionResult<WordReviewPlan>> GetWordReviewPlan(
|
||||
[FromQuery] LearningLimitQueryDto query,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
return Ok(await learningActivityService.GetWordReviewPlanAsync(
|
||||
ResolveActor(),
|
||||
query.ToFilter(),
|
||||
cancellationToken));
|
||||
}
|
||||
|
||||
[HttpPost("vocabulary/progress")]
|
||||
[EndpointSummary("更新单词学习进度")]
|
||||
[ProducesResponseType<WordProgressItem>(StatusCodes.Status200OK)]
|
||||
@@ -194,6 +248,33 @@ public sealed class LearningController(
|
||||
cancellationToken));
|
||||
}
|
||||
|
||||
[HttpPost("vocabulary/review")]
|
||||
[EndpointSummary("提交单词复习结果")]
|
||||
[ProducesResponseType<WordProgressItem>(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType<ProblemDetails>(StatusCodes.Status404NotFound)]
|
||||
public async Task<ActionResult<WordProgressItem>> ReviewWord(
|
||||
WordReviewDto request,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
return Ok(await learningActivityService.ReviewWordAsync(
|
||||
ResolveActor(),
|
||||
request.ToCommand(),
|
||||
cancellationToken));
|
||||
}
|
||||
|
||||
[HttpGet("vocabulary/stats")]
|
||||
[EndpointSummary("查询单词学习统计")]
|
||||
[ProducesResponseType<WordStatsItem>(StatusCodes.Status200OK)]
|
||||
public async Task<ActionResult<WordStatsItem>> GetWordStats(
|
||||
[FromQuery] LearningLimitQueryDto query,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
return Ok(await learningActivityService.GetWordStatsAsync(
|
||||
ResolveActor(),
|
||||
query.ToFilter(),
|
||||
cancellationToken));
|
||||
}
|
||||
|
||||
[HttpGet("vocabulary/favorites")]
|
||||
[EndpointSummary("查询收藏单词")]
|
||||
[ProducesResponseType<LearningList<FavoriteWordItem>>(StatusCodes.Status200OK)]
|
||||
|
||||
Reference in New Issue
Block a user