feat: add core persistence model
This commit is contained in:
71
Tiku.Domain/QuestionBanks/QuestionEntities.cs
Normal file
71
Tiku.Domain/QuestionBanks/QuestionEntities.cs
Normal file
@@ -0,0 +1,71 @@
|
||||
using System.Text.Json;
|
||||
using Tiku.Domain.Common;
|
||||
|
||||
namespace Tiku.Domain.QuestionBanks;
|
||||
|
||||
public sealed class QuestionBank : AuditableTenantEntity
|
||||
{
|
||||
public Guid? RegionId { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public QuestionBankScope SourceScope { get; set; } = QuestionBankScope.Tenant;
|
||||
public QuestionBankStatus Status { get; set; } = QuestionBankStatus.Active;
|
||||
public JsonElement Metadata { get; set; } = JsonDefaults.Object();
|
||||
}
|
||||
|
||||
public enum QuestionBankScope
|
||||
{
|
||||
Platform,
|
||||
Tenant
|
||||
}
|
||||
|
||||
public enum QuestionBankStatus
|
||||
{
|
||||
Active,
|
||||
Archived
|
||||
}
|
||||
|
||||
public sealed class Question : AuditableTenantEntity
|
||||
{
|
||||
public Guid? QuestionBankId { get; set; }
|
||||
public Guid? SubjectId { get; set; }
|
||||
public Guid? CategoryId { get; set; }
|
||||
public Guid? NodeId { get; set; }
|
||||
public string? LegacyId { get; set; }
|
||||
public string? LegacySubjectId { get; set; }
|
||||
public string? LegacyCategoryId { get; set; }
|
||||
public string? LegacyNodeId { get; set; }
|
||||
public string Type { get; set; } = "choice";
|
||||
public string? TypeLabel { get; set; }
|
||||
public int? Difficulty { get; set; }
|
||||
public JsonElement Tags { get; set; } = JsonDefaults.Array();
|
||||
public string? MediaUrl { get; set; }
|
||||
public bool HasVideoExplanation { get; set; }
|
||||
public QuestionStatus Status { get; set; } = QuestionStatus.Published;
|
||||
public Guid? CurrentVersionId { get; set; }
|
||||
}
|
||||
|
||||
public enum QuestionStatus
|
||||
{
|
||||
Draft,
|
||||
Published,
|
||||
Archived
|
||||
}
|
||||
|
||||
public sealed class QuestionVersion : Entity
|
||||
{
|
||||
public Guid TenantId { get; set; }
|
||||
public Guid QuestionId { get; set; }
|
||||
public int VersionNo { get; set; } = 1;
|
||||
public string? Content { get; set; }
|
||||
public JsonElement Options { get; set; } = JsonDefaults.Array();
|
||||
public int? CorrectOptionIndex { get; set; }
|
||||
public JsonElement CorrectOptionIndices { get; set; } = JsonDefaults.Array();
|
||||
public string? AnswerText { get; set; }
|
||||
public string? Explanation { get; set; }
|
||||
public JsonElement SubQuestions { get; set; } = JsonDefaults.Array();
|
||||
public string? CodeLang { get; set; }
|
||||
public string? CodeTemplate { get; set; }
|
||||
public string? SourceHash { get; set; }
|
||||
public Guid? CreatedBy { get; set; }
|
||||
public DateTimeOffset CreatedAt { get; set; } = DateTimeOffset.UtcNow;
|
||||
}
|
||||
Reference in New Issue
Block a user