forked from xiongyuxing/tiku-backend.net
feat: add vocabulary and handbook persistence
This commit is contained in:
171
Tiku.Domain/Content/StudyContentEntities.cs
Normal file
171
Tiku.Domain/Content/StudyContentEntities.cs
Normal file
@@ -0,0 +1,171 @@
|
||||
using System.Text.Json;
|
||||
using Tiku.Domain.Common;
|
||||
|
||||
namespace Tiku.Domain.Content;
|
||||
|
||||
public sealed class VocabularyUnit : AuditableTenantEntity
|
||||
{
|
||||
public Guid? RegionId { get; set; }
|
||||
public Guid? EntryId { get; set; }
|
||||
public Guid? ContentNodeId { get; set; }
|
||||
public string? LegacyId { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public string? Description { get; set; }
|
||||
public int? WordCount { get; set; }
|
||||
public int SortOrder { get; set; }
|
||||
public bool IsActive { get; set; } = true;
|
||||
public string? SourceHash { get; set; }
|
||||
public JsonElement Metadata { get; set; } = JsonDefaults.Object();
|
||||
}
|
||||
|
||||
public sealed class VocabularyWord : AuditableTenantEntity
|
||||
{
|
||||
public Guid? UnitId { get; set; }
|
||||
public Guid? EntryId { get; set; }
|
||||
public Guid? ContentNodeId { get; set; }
|
||||
public string? LegacyId { get; set; }
|
||||
public string Word { get; set; } = string.Empty;
|
||||
public string? Phonetic { get; set; }
|
||||
public string? Meaning { get; set; }
|
||||
public string? Example { get; set; }
|
||||
public string? ExampleTranslation { get; set; }
|
||||
public int? Difficulty { get; set; }
|
||||
public JsonElement Tags { get; set; } = JsonDefaults.Array();
|
||||
public int SortOrder { get; set; }
|
||||
public bool IsActive { get; set; } = true;
|
||||
public string? SourceHash { get; set; }
|
||||
public JsonElement Metadata { get; set; } = JsonDefaults.Object();
|
||||
}
|
||||
|
||||
public sealed class UserWordProgress : AuditableTenantEntity
|
||||
{
|
||||
public Guid UserId { get; set; }
|
||||
public Guid WordId { get; set; }
|
||||
public string? LegacyId { get; set; }
|
||||
public string? LegacyUserId { get; set; }
|
||||
public string? LegacyWordId { get; set; }
|
||||
public WordProgressStatus Status { get; set; } = WordProgressStatus.New;
|
||||
public int CorrectCount { get; set; }
|
||||
public int WrongCount { get; set; }
|
||||
public DateTimeOffset? LastReviewAt { get; set; }
|
||||
public DateTimeOffset? NextReviewAt { get; set; }
|
||||
public int ReviewCount { get; set; }
|
||||
public int CorrectStreak { get; set; }
|
||||
public decimal EaseFactor { get; set; } = 2.50m;
|
||||
public WordReviewResult? LastResult { get; set; }
|
||||
public WordDueLevel DueLevel { get; set; } = WordDueLevel.New;
|
||||
public JsonElement Metadata { get; set; } = JsonDefaults.Object();
|
||||
}
|
||||
|
||||
public sealed class UserWordFavorite : AuditableTenantEntity
|
||||
{
|
||||
public Guid UserId { get; set; }
|
||||
public Guid WordId { get; set; }
|
||||
public string? LegacyId { get; set; }
|
||||
public string? LegacyUserId { get; set; }
|
||||
public string? LegacyWordId { get; set; }
|
||||
public string? Note { get; set; }
|
||||
public DateTimeOffset? FavoritedAt { get; set; }
|
||||
}
|
||||
|
||||
public sealed class HandbookSubject : AuditableTenantEntity
|
||||
{
|
||||
public Guid? RegionId { get; set; }
|
||||
public Guid? SchoolId { get; set; }
|
||||
public Guid? MajorId { get; set; }
|
||||
public Guid? EntryId { get; set; }
|
||||
public Guid? ContentNodeId { get; set; }
|
||||
public string? LegacyId { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public HandbookSubjectType? Type { get; set; }
|
||||
public string? Icon { get; set; }
|
||||
public string? Color { get; set; }
|
||||
public string? Description { get; set; }
|
||||
public JsonElement MajorLegacyIds { get; set; } = JsonDefaults.Array();
|
||||
public int SortOrder { get; set; }
|
||||
public bool IsActive { get; set; } = true;
|
||||
public string? SourceHash { get; set; }
|
||||
public JsonElement Metadata { get; set; } = JsonDefaults.Object();
|
||||
}
|
||||
|
||||
public sealed class HandbookChapter : AuditableTenantEntity
|
||||
{
|
||||
public Guid? SubjectId { get; set; }
|
||||
public Guid? EntryId { get; set; }
|
||||
public Guid? ContentNodeId { get; set; }
|
||||
public string? LegacyId { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public string? Description { get; set; }
|
||||
public int SortOrder { get; set; }
|
||||
public bool IsActive { get; set; } = true;
|
||||
public string? SourceHash { get; set; }
|
||||
public JsonElement Metadata { get; set; } = JsonDefaults.Object();
|
||||
}
|
||||
|
||||
public sealed class HandbookEntry : AuditableTenantEntity
|
||||
{
|
||||
public Guid? ChapterId { get; set; }
|
||||
public Guid? EntryId { get; set; }
|
||||
public Guid? ContentNodeId { get; set; }
|
||||
public string? LegacyId { get; set; }
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public string? Summary { get; set; }
|
||||
public string? Content { get; set; }
|
||||
public JsonElement Tags { get; set; } = JsonDefaults.Array();
|
||||
public int SortOrder { get; set; }
|
||||
public bool IsActive { get; set; } = true;
|
||||
public string? SourceHash { get; set; }
|
||||
public JsonElement Metadata { get; set; } = JsonDefaults.Object();
|
||||
}
|
||||
|
||||
public sealed class QuestionTypeGroup : AuditableTenantEntity
|
||||
{
|
||||
public Guid? SubjectId { get; set; }
|
||||
public string? LegacyId { get; set; }
|
||||
public string DisplayName { get; set; } = string.Empty;
|
||||
public JsonElement Types { get; set; } = JsonDefaults.Array();
|
||||
public int SortOrder { get; set; }
|
||||
public bool IsActive { get; set; } = true;
|
||||
}
|
||||
|
||||
public sealed class SubjectShare : AuditableTenantEntity
|
||||
{
|
||||
public Guid? SourceSubjectId { get; set; }
|
||||
public Guid? TargetSubjectId { get; set; }
|
||||
public string? LegacyId { get; set; }
|
||||
public string? LegacySourceSubjectId { get; set; }
|
||||
public string? LegacyTargetSubjectId { get; set; }
|
||||
}
|
||||
|
||||
public enum WordProgressStatus
|
||||
{
|
||||
New,
|
||||
Learning,
|
||||
Mastered,
|
||||
Reviewing,
|
||||
Forgotten
|
||||
}
|
||||
|
||||
public enum WordReviewResult
|
||||
{
|
||||
Correct,
|
||||
Wrong,
|
||||
Known,
|
||||
Unknown
|
||||
}
|
||||
|
||||
public enum WordDueLevel
|
||||
{
|
||||
New,
|
||||
Again,
|
||||
Soon,
|
||||
Later,
|
||||
Mastered
|
||||
}
|
||||
|
||||
public enum HandbookSubjectType
|
||||
{
|
||||
Cultural,
|
||||
Professional,
|
||||
Common
|
||||
}
|
||||
Reference in New Issue
Block a user