forked from gongxuegit/tiku-backend.net
feat: add practice session workflow endpoints
This commit is contained in:
@@ -46,4 +46,34 @@ public interface ILearningActivityService
|
||||
LearningActor actor,
|
||||
FavoriteWordCommand command,
|
||||
CancellationToken cancellationToken = default);
|
||||
|
||||
Task<PracticeSessionItem> CreatePracticeSessionAsync(
|
||||
LearningActor actor,
|
||||
PracticeSessionCommand command,
|
||||
CancellationToken cancellationToken = default);
|
||||
|
||||
Task<PracticeSessionDetailItem> GetPracticeSessionDetailAsync(
|
||||
LearningActor actor,
|
||||
PracticeSessionFilter filter,
|
||||
CancellationToken cancellationToken = default);
|
||||
|
||||
Task<PracticeSessionReportItem> SubmitPracticeSessionAsync(
|
||||
LearningActor actor,
|
||||
PracticeSessionFilter filter,
|
||||
CancellationToken cancellationToken = default);
|
||||
|
||||
Task<PracticeSessionReportItem> GetPracticeSessionReportAsync(
|
||||
LearningActor actor,
|
||||
PracticeSessionFilter filter,
|
||||
CancellationToken cancellationToken = default);
|
||||
|
||||
Task<LearningList<PracticeSessionReportItem>> GetPracticeReportsAsync(
|
||||
LearningActor actor,
|
||||
PracticeSessionFilter filter,
|
||||
CancellationToken cancellationToken = default);
|
||||
|
||||
Task<LearningList<PracticeHistoryItem>> GetPracticeHistoryAsync(
|
||||
LearningActor actor,
|
||||
PracticeSessionFilter filter,
|
||||
CancellationToken cancellationToken = default);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Text.Json;
|
||||
using Tiku.Domain.Content;
|
||||
using Tiku.Domain.Learning;
|
||||
|
||||
namespace Tiku.Application.Learning;
|
||||
|
||||
@@ -27,6 +28,26 @@ public sealed record FavoriteWordCommand(Guid WordId, bool? Favorite, string? No
|
||||
|
||||
public sealed record LearningLimitFilter(int? Limit = null, string? Status = null, Guid? UnitId = null);
|
||||
|
||||
public sealed record PracticeSessionCommand(
|
||||
string? Mode,
|
||||
string? TargetType,
|
||||
Guid? TargetId,
|
||||
Guid? BlueprintId,
|
||||
Guid? CollectionId,
|
||||
Guid? EntryId,
|
||||
Guid? ContentNodeId,
|
||||
int? QuestionLimit,
|
||||
int? DurationMinutes,
|
||||
decimal? TotalScore,
|
||||
JsonElement Metadata);
|
||||
|
||||
public sealed record PracticeSessionFilter(
|
||||
Guid? PracticeSessionId = null,
|
||||
Guid? BlueprintId = null,
|
||||
string? Mode = null,
|
||||
string? Status = null,
|
||||
int? Limit = null);
|
||||
|
||||
public sealed record AnswerRecordItem(
|
||||
Guid Id,
|
||||
Guid QuestionId,
|
||||
@@ -67,3 +88,86 @@ public sealed record FavoriteWordItem(
|
||||
DateTimeOffset? FavoritedAt);
|
||||
|
||||
public sealed record LearningActionResult(bool Ok, bool? IsFavorite = null);
|
||||
|
||||
public sealed record PracticeSessionItem(
|
||||
Guid Id,
|
||||
string Mode,
|
||||
string? TargetType,
|
||||
Guid? TargetId,
|
||||
Guid? BlueprintId,
|
||||
Guid? CollectionId,
|
||||
Guid? EntryId,
|
||||
Guid? ContentNodeId,
|
||||
JsonElement QuestionIds,
|
||||
int QuestionCount,
|
||||
int? DurationMinutes,
|
||||
decimal? TotalScore,
|
||||
PracticeAccessMode AccessMode,
|
||||
Guid? AccessEntitlementId,
|
||||
int ConsumedFreeQuota,
|
||||
JsonElement AccessSnapshot,
|
||||
DateTimeOffset StartedAt,
|
||||
DateTimeOffset? FinishedAt,
|
||||
DateTimeOffset? ExpiresAt,
|
||||
JsonElement Metadata,
|
||||
string Status);
|
||||
|
||||
public sealed record PracticeSessionDetailItem(
|
||||
PracticeSessionItem Session,
|
||||
IReadOnlyCollection<PracticeSessionQuestionItem> Questions,
|
||||
IReadOnlyDictionary<Guid, AnswerRecordItem> AnswersByQuestion);
|
||||
|
||||
public sealed record PracticeSessionQuestionItem(
|
||||
Guid Id,
|
||||
string Type,
|
||||
string? TypeLabel,
|
||||
int? Difficulty,
|
||||
JsonElement Tags,
|
||||
Guid? VersionId,
|
||||
string? Content,
|
||||
JsonElement Options,
|
||||
string? Explanation);
|
||||
|
||||
public sealed record PracticeSessionReportItem(
|
||||
Guid Id,
|
||||
Guid PracticeSessionId,
|
||||
Guid? BlueprintId,
|
||||
Guid? CollectionId,
|
||||
string Mode,
|
||||
int TotalQuestions,
|
||||
int AnsweredCount,
|
||||
int CorrectCount,
|
||||
int WrongCount,
|
||||
int UnansweredCount,
|
||||
decimal Score,
|
||||
decimal TotalScore,
|
||||
decimal Accuracy,
|
||||
int DurationSeconds,
|
||||
DateTimeOffset? StartedAt,
|
||||
DateTimeOffset SubmittedAt,
|
||||
JsonElement SectionStats,
|
||||
JsonElement QuestionResults,
|
||||
JsonElement WrongQuestionIds,
|
||||
JsonElement Metadata);
|
||||
|
||||
public sealed record PracticeHistoryItem(
|
||||
Guid Id,
|
||||
string Mode,
|
||||
string? TargetType,
|
||||
Guid? TargetId,
|
||||
Guid? BlueprintId,
|
||||
Guid? CollectionId,
|
||||
Guid? EntryId,
|
||||
Guid? ContentNodeId,
|
||||
int QuestionCount,
|
||||
int AnsweredCount,
|
||||
int CorrectCount,
|
||||
int WrongCount,
|
||||
DateTimeOffset StartedAt,
|
||||
DateTimeOffset? FinishedAt,
|
||||
DateTimeOffset? ExpiresAt,
|
||||
string Status,
|
||||
Guid? ReportId,
|
||||
decimal? Score,
|
||||
decimal? ReportTotalScore,
|
||||
decimal? Accuracy);
|
||||
|
||||
Reference in New Issue
Block a user