forked from gongxuegit/tiku-backend.net
feat: add learning activity endpoints
This commit is contained in:
101
Tiku.Api/Contracts/LearningDtos.cs
Normal file
101
Tiku.Api/Contracts/LearningDtos.cs
Normal file
@@ -0,0 +1,101 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Tiku.Application.Learning;
|
||||
|
||||
namespace Tiku.Api.Contracts;
|
||||
|
||||
public sealed class LearningLimitQueryDto
|
||||
{
|
||||
[Range(1, 500)]
|
||||
public int? Limit { get; set; }
|
||||
|
||||
[StringLength(50)]
|
||||
public string? Status { get; set; }
|
||||
|
||||
public Guid? UnitId { get; set; }
|
||||
|
||||
public LearningLimitFilter ToFilter()
|
||||
{
|
||||
return new LearningLimitFilter(Limit, Status, UnitId);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class SubmitAnswerDto
|
||||
{
|
||||
[Required]
|
||||
public Guid QuestionId { get; set; }
|
||||
|
||||
public Guid? PracticeSessionId { get; set; }
|
||||
|
||||
public IReadOnlyCollection<string>? SelectedOptions { get; set; }
|
||||
|
||||
[StringLength(10000)]
|
||||
public string? AnswerText { get; set; }
|
||||
|
||||
public bool? SelfJudgedCorrect { get; set; }
|
||||
|
||||
public SubmitAnswerCommand ToCommand()
|
||||
{
|
||||
return new SubmitAnswerCommand(
|
||||
QuestionId,
|
||||
PracticeSessionId,
|
||||
SelectedOptions,
|
||||
AnswerText,
|
||||
SelfJudgedCorrect);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class QuestionActionDto
|
||||
{
|
||||
[Required]
|
||||
public Guid QuestionId { get; set; }
|
||||
|
||||
public bool? Favorite { get; set; }
|
||||
|
||||
public QuestionActionCommand ToCommand()
|
||||
{
|
||||
return new QuestionActionCommand(QuestionId, Favorite);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class WordProgressDto
|
||||
{
|
||||
[Required]
|
||||
public Guid WordId { get; set; }
|
||||
|
||||
[StringLength(50)]
|
||||
public string? Status { get; set; }
|
||||
|
||||
[Range(0, 100)]
|
||||
public int? CorrectDelta { get; set; }
|
||||
|
||||
[Range(0, 100)]
|
||||
public int? WrongDelta { get; set; }
|
||||
|
||||
public DateTimeOffset? NextReviewAt { get; set; }
|
||||
|
||||
public WordProgressCommand ToCommand()
|
||||
{
|
||||
return new WordProgressCommand(
|
||||
WordId,
|
||||
Status,
|
||||
CorrectDelta,
|
||||
WrongDelta,
|
||||
NextReviewAt);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class FavoriteWordDto
|
||||
{
|
||||
[Required]
|
||||
public Guid WordId { get; set; }
|
||||
|
||||
public bool? Favorite { get; set; }
|
||||
|
||||
[StringLength(1000)]
|
||||
public string? Note { get; set; }
|
||||
|
||||
public FavoriteWordCommand ToCommand()
|
||||
{
|
||||
return new FavoriteWordCommand(WordId, Favorite, Note);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user