feat: add practice session workflow endpoints

This commit is contained in:
xiong
2026-07-26 15:25:33 +08:00
parent db319ef5a2
commit e505384ecf
7 changed files with 1090 additions and 1 deletions

View File

@@ -1,5 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.Text.Json;
using Tiku.Application.Learning;
using Tiku.Domain.Common;
namespace Tiku.Api.Contracts;
@@ -19,6 +21,89 @@ public sealed class LearningLimitQueryDto
}
}
public sealed class PracticeSessionQueryDto
{
public Guid? PracticeSessionId { get; set; }
public Guid? BlueprintId { get; set; }
[StringLength(50)]
public string? Mode { get; set; }
[StringLength(50)]
public string? Status { get; set; }
[Range(1, 200)]
public int? Limit { get; set; }
public PracticeSessionFilter ToFilter(Guid? routePracticeSessionId = null)
{
return new PracticeSessionFilter(
routePracticeSessionId ?? PracticeSessionId,
BlueprintId,
Mode,
Status,
Limit);
}
}
public sealed class CreatePracticeSessionDto
{
[StringLength(50)]
public string? Mode { get; set; }
[StringLength(50)]
public string? TargetType { get; set; }
public Guid? TargetId { get; set; }
public Guid? BlueprintId { get; set; }
public Guid? CollectionId { get; set; }
public Guid? EntryId { get; set; }
public Guid? ContentNodeId { get; set; }
[Range(1, 500)]
public int? QuestionLimit { get; set; }
[Range(1, 1440)]
public int? DurationMinutes { get; set; }
[Range(typeof(decimal), "0", "99999")]
public decimal? TotalScore { get; set; }
public JsonElement Metadata { get; set; } = JsonDefaults.Object();
public PracticeSessionCommand ToCommand()
{
return new PracticeSessionCommand(
Mode,
TargetType,
TargetId,
BlueprintId,
CollectionId,
EntryId,
ContentNodeId,
QuestionLimit,
DurationMinutes,
TotalScore,
Metadata);
}
}
public sealed class SubmitPracticeSessionDto
{
[Required]
public Guid PracticeSessionId { get; set; }
public PracticeSessionFilter ToFilter()
{
return new PracticeSessionFilter(PracticeSessionId);
}
}
public sealed class SubmitAnswerDto
{
[Required]