forked from gongxuegit/tiku-backend.net
feat: add core persistence model
This commit is contained in:
64
Tiku.Domain/Learning/LearningEntities.cs
Normal file
64
Tiku.Domain/Learning/LearningEntities.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
using System.Text.Json;
|
||||
using Tiku.Domain.Common;
|
||||
|
||||
namespace Tiku.Domain.Learning;
|
||||
|
||||
public sealed class PracticeSession : TenantEntity
|
||||
{
|
||||
public Guid UserId { get; set; }
|
||||
public string Mode { get; set; } = "chapter";
|
||||
public string? TargetType { get; set; }
|
||||
public Guid? TargetId { get; set; }
|
||||
public DateTimeOffset StartedAt { get; set; } = DateTimeOffset.UtcNow;
|
||||
public DateTimeOffset? FinishedAt { get; set; }
|
||||
public JsonElement Metadata { get; set; } = JsonDefaults.Object();
|
||||
}
|
||||
|
||||
public sealed class AnswerRecord : TenantEntity
|
||||
{
|
||||
public Guid UserId { get; set; }
|
||||
public Guid? QuestionId { get; set; }
|
||||
public Guid? QuestionVersionId { get; set; }
|
||||
public Guid? PracticeSessionId { get; set; }
|
||||
public string? LegacyId { get; set; }
|
||||
public string? LegacyQuestionId { get; set; }
|
||||
public string? LegacyCategoryId { get; set; }
|
||||
public JsonElement SelectedOptions { get; set; } = JsonDefaults.Array();
|
||||
public string? AnswerText { get; set; }
|
||||
public bool? IsCorrect { get; set; }
|
||||
public DateTimeOffset AnsweredAt { get; set; } = DateTimeOffset.UtcNow;
|
||||
public DateTimeOffset CreatedAt { get; set; } = DateTimeOffset.UtcNow;
|
||||
}
|
||||
|
||||
public sealed class FavoriteQuestion
|
||||
{
|
||||
public Guid TenantId { get; set; }
|
||||
public Guid UserId { get; set; }
|
||||
public Guid QuestionId { get; set; }
|
||||
public string Source { get; set; } = "imported";
|
||||
public DateTimeOffset CreatedAt { get; set; } = DateTimeOffset.UtcNow;
|
||||
}
|
||||
|
||||
public sealed class WrongQuestion
|
||||
{
|
||||
public Guid TenantId { get; set; }
|
||||
public Guid UserId { get; set; }
|
||||
public Guid QuestionId { get; set; }
|
||||
public int WrongCount { get; set; } = 1;
|
||||
public DateTimeOffset LastWrongAt { get; set; } = DateTimeOffset.UtcNow;
|
||||
public DateTimeOffset? ResolvedAt { get; set; }
|
||||
}
|
||||
|
||||
public sealed class RecentPractice : AuditableTenantEntity
|
||||
{
|
||||
public Guid? UserId { get; set; }
|
||||
public string? LegacyId { get; set; }
|
||||
public string? PracticeType { get; set; }
|
||||
public string? TargetLegacyId { get; set; }
|
||||
public string? TargetName { get; set; }
|
||||
public int Progress { get; set; }
|
||||
public string? Color { get; set; }
|
||||
public DateTimeOffset? LastAccessAt { get; set; }
|
||||
public DateTimeOffset? LastPracticeAt { get; set; }
|
||||
public JsonElement Metadata { get; set; } = JsonDefaults.Object();
|
||||
}
|
||||
Reference in New Issue
Block a user