forked from gongxuegit/tiku-backend.net
feat: add content navigation and tenant configuration
This commit is contained in:
188
Tiku.Domain/Content/ContentEntities.cs
Normal file
188
Tiku.Domain/Content/ContentEntities.cs
Normal file
@@ -0,0 +1,188 @@
|
||||
using System.Text.Json;
|
||||
using Tiku.Domain.Common;
|
||||
|
||||
namespace Tiku.Domain.Content;
|
||||
|
||||
public sealed class ContentEntry : AuditableTenantEntity
|
||||
{
|
||||
public Guid? RegionId { get; set; }
|
||||
public string? LegacyId { get; set; }
|
||||
public string EntryKey { get; set; } = string.Empty;
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public ContentEntryType EntryType { get; set; } = ContentEntryType.QuestionPractice;
|
||||
public string? Icon { get; set; }
|
||||
public string? Route { get; set; }
|
||||
public string? Description { get; set; }
|
||||
public ContentVisibility Visibility { get; set; } = ContentVisibility.Public;
|
||||
public JsonElement AccessRules { get; set; } = JsonDefaults.Object();
|
||||
public JsonElement LayoutConfig { get; set; } = JsonDefaults.Object();
|
||||
public int SortOrder { get; set; }
|
||||
public bool IsActive { get; set; } = true;
|
||||
public Guid? CreatedBy { get; set; }
|
||||
public Guid? UpdatedBy { get; set; }
|
||||
}
|
||||
|
||||
public enum ContentEntryType
|
||||
{
|
||||
QuestionPractice,
|
||||
Vocabulary,
|
||||
Handbook,
|
||||
Scoreline,
|
||||
Resource,
|
||||
AiReport,
|
||||
Custom
|
||||
}
|
||||
|
||||
public enum ContentVisibility
|
||||
{
|
||||
Public,
|
||||
Members,
|
||||
Svip,
|
||||
Hidden
|
||||
}
|
||||
|
||||
public sealed class ContentNode : AuditableTenantEntity
|
||||
{
|
||||
public Guid EntryId { get; set; }
|
||||
public Guid? RegionId { get; set; }
|
||||
public Guid? ParentId { get; set; }
|
||||
public string? LegacyId { get; set; }
|
||||
public string? NodeKey { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public ContentNodeType NodeType { get; set; } = ContentNodeType.Category;
|
||||
public ContentMarkerType? MarkerType { get; set; }
|
||||
public JsonElement MarkerConfig { get; set; } = JsonDefaults.Object();
|
||||
public string? Path { get; set; }
|
||||
public int Depth { get; set; }
|
||||
public int SortOrder { get; set; }
|
||||
public bool IsActive { get; set; } = true;
|
||||
public bool IsSelectable { get; set; } = true;
|
||||
public bool IsLeaf { get; set; }
|
||||
public JsonElement Metadata { get; set; } = JsonDefaults.Object();
|
||||
public Guid? CreatedBy { get; set; }
|
||||
public Guid? UpdatedBy { get; set; }
|
||||
}
|
||||
|
||||
public enum ContentNodeType
|
||||
{
|
||||
Category,
|
||||
Subject,
|
||||
Chapter,
|
||||
Paper,
|
||||
School,
|
||||
Major,
|
||||
ExamTarget,
|
||||
ResourceGroup,
|
||||
Custom
|
||||
}
|
||||
|
||||
public enum ContentMarkerType
|
||||
{
|
||||
School,
|
||||
Major,
|
||||
Subject,
|
||||
ExamTrack,
|
||||
CoursePackage,
|
||||
SalesIntent,
|
||||
Custom
|
||||
}
|
||||
|
||||
public sealed class QuestionCollection : AuditableTenantEntity
|
||||
{
|
||||
public Guid? RegionId { get; set; }
|
||||
public Guid? EntryId { get; set; }
|
||||
public Guid? NodeId { get; set; }
|
||||
public Guid? SubjectId { get; set; }
|
||||
public Guid? CategoryId { get; set; }
|
||||
public Guid? QuestionBankId { get; set; }
|
||||
public string? LegacyId { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public QuestionCollectionType CollectionType { get; set; } = QuestionCollectionType.Dynamic;
|
||||
public QuestionCollectionSourceType SourceType { get; set; } = QuestionCollectionSourceType.Filters;
|
||||
public JsonElement Filters { get; set; } = JsonDefaults.Object();
|
||||
public int QuestionCount { get; set; }
|
||||
public decimal? TotalScore { get; set; }
|
||||
public int? DurationMinutes { get; set; }
|
||||
public ContentStatus Status { get; set; } = ContentStatus.Active;
|
||||
public int SortOrder { get; set; }
|
||||
public JsonElement Metadata { get; set; } = JsonDefaults.Object();
|
||||
public Guid? CreatedBy { get; set; }
|
||||
public Guid? UpdatedBy { get; set; }
|
||||
}
|
||||
|
||||
public enum QuestionCollectionType
|
||||
{
|
||||
Dynamic,
|
||||
Manual,
|
||||
Paper,
|
||||
Chapter,
|
||||
MockExam
|
||||
}
|
||||
|
||||
public enum QuestionCollectionSourceType
|
||||
{
|
||||
Filters,
|
||||
ManualQuestions,
|
||||
NodeDescendants,
|
||||
Category,
|
||||
Subject,
|
||||
QuestionBank
|
||||
}
|
||||
|
||||
public enum ContentStatus
|
||||
{
|
||||
Draft,
|
||||
Active,
|
||||
Archived
|
||||
}
|
||||
|
||||
public sealed class QuestionCollectionItem : AuditableTenantEntity
|
||||
{
|
||||
public Guid CollectionId { get; set; }
|
||||
public Guid QuestionId { get; set; }
|
||||
public string? SectionKey { get; set; }
|
||||
public int SortOrder { get; set; }
|
||||
public decimal? Score { get; set; }
|
||||
public bool Required { get; set; } = true;
|
||||
public JsonElement Metadata { get; set; } = JsonDefaults.Object();
|
||||
}
|
||||
|
||||
public sealed class PracticeBlueprint : AuditableTenantEntity
|
||||
{
|
||||
public Guid? RegionId { get; set; }
|
||||
public Guid? EntryId { get; set; }
|
||||
public Guid? NodeId { get; set; }
|
||||
public Guid? CollectionId { get; set; }
|
||||
public string? LegacyId { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public PracticeMode Mode { get; set; } = PracticeMode.Sequential;
|
||||
public PracticeAssemblyType AssemblyType { get; set; } = PracticeAssemblyType.Collection;
|
||||
public int? QuestionLimit { get; set; }
|
||||
public int? DurationMinutes { get; set; }
|
||||
public decimal? TotalScore { get; set; }
|
||||
public decimal? PassScore { get; set; }
|
||||
public JsonElement Sections { get; set; } = JsonDefaults.Array();
|
||||
public JsonElement Rules { get; set; } = JsonDefaults.Object();
|
||||
public ContentStatus Status { get; set; } = ContentStatus.Active;
|
||||
public int SortOrder { get; set; }
|
||||
public Guid? CreatedBy { get; set; }
|
||||
public Guid? UpdatedBy { get; set; }
|
||||
}
|
||||
|
||||
public enum PracticeMode
|
||||
{
|
||||
Sequential,
|
||||
Random,
|
||||
MockExam,
|
||||
Paper,
|
||||
WrongReview,
|
||||
FavoriteReview
|
||||
}
|
||||
|
||||
public enum PracticeAssemblyType
|
||||
{
|
||||
Collection,
|
||||
NodeDescendants,
|
||||
Manual,
|
||||
Filters
|
||||
}
|
||||
@@ -6,11 +6,20 @@ namespace Tiku.Domain.Learning;
|
||||
public sealed class PracticeSession : TenantEntity
|
||||
{
|
||||
public Guid UserId { get; set; }
|
||||
public Guid? BlueprintId { get; set; }
|
||||
public Guid? CollectionId { get; set; }
|
||||
public Guid? EntryId { get; set; }
|
||||
public Guid? ContentNodeId { 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 QuestionIds { get; set; } = JsonDefaults.Array();
|
||||
public int QuestionCount { get; set; }
|
||||
public int? DurationMinutes { get; set; }
|
||||
public decimal? TotalScore { get; set; }
|
||||
public DateTimeOffset? ExpiresAt { get; set; }
|
||||
public JsonElement Metadata { get; set; } = JsonDefaults.Object();
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,9 @@ public sealed class Question : AuditableTenantEntity
|
||||
public Guid? SubjectId { get; set; }
|
||||
public Guid? CategoryId { get; set; }
|
||||
public Guid? NodeId { get; set; }
|
||||
public Guid? EntryId { get; set; }
|
||||
public Guid? ContentNodeId { get; set; }
|
||||
public Guid? PrimaryCollectionId { get; set; }
|
||||
public string? LegacyId { get; set; }
|
||||
public string? LegacySubjectId { get; set; }
|
||||
public string? LegacyCategoryId { get; set; }
|
||||
@@ -38,6 +41,7 @@ public sealed class Question : AuditableTenantEntity
|
||||
public string? TypeLabel { get; set; }
|
||||
public int? Difficulty { get; set; }
|
||||
public JsonElement Tags { get; set; } = JsonDefaults.Array();
|
||||
public JsonElement ExamMarkers { get; set; } = JsonDefaults.Object();
|
||||
public string? MediaUrl { get; set; }
|
||||
public bool HasVideoExplanation { get; set; }
|
||||
public QuestionStatus Status { get; set; } = QuestionStatus.Published;
|
||||
|
||||
56
Tiku.Domain/Tenancy/TenantConfigurationEntities.cs
Normal file
56
Tiku.Domain/Tenancy/TenantConfigurationEntities.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
using System.Text.Json;
|
||||
using Tiku.Domain.Common;
|
||||
|
||||
namespace Tiku.Domain.Tenancy;
|
||||
|
||||
public sealed class TenantDomain : AuditableTenantEntity
|
||||
{
|
||||
public string Host { get; set; } = string.Empty;
|
||||
public TenantDomainType DomainType { get; set; } = TenantDomainType.Custom;
|
||||
public TenantDomainStatus Status { get; set; } = TenantDomainStatus.Pending;
|
||||
public bool IsPrimary { get; set; }
|
||||
public string? VerificationToken { get; set; }
|
||||
public DateTimeOffset? VerifiedAt { get; set; }
|
||||
}
|
||||
|
||||
public enum TenantDomainType
|
||||
{
|
||||
System,
|
||||
Custom,
|
||||
Miniapp
|
||||
}
|
||||
|
||||
public enum TenantDomainStatus
|
||||
{
|
||||
Pending,
|
||||
Active,
|
||||
Failed,
|
||||
Disabled
|
||||
}
|
||||
|
||||
public sealed class TenantBranding : IHasTimestamps
|
||||
{
|
||||
public Guid TenantId { get; set; }
|
||||
public string BrandName { get; set; } = string.Empty;
|
||||
public string? ShortName { get; set; }
|
||||
public string? Slogan { get; set; }
|
||||
public string? OrganizationName { get; set; }
|
||||
public string? LogoUrl { get; set; }
|
||||
public string? FaviconUrl { get; set; }
|
||||
public string? ServiceWechat { get; set; }
|
||||
public string? ServiceAccountName { get; set; }
|
||||
public JsonElement Theme { get; set; } = JsonDefaults.Object();
|
||||
public JsonElement PublicAssets { get; set; } = JsonDefaults.Object();
|
||||
public DateTimeOffset CreatedAt { get; set; } = DateTimeOffset.UtcNow;
|
||||
public DateTimeOffset UpdatedAt { get; set; } = DateTimeOffset.UtcNow;
|
||||
}
|
||||
|
||||
public sealed class TenantSettings : IHasTimestamps
|
||||
{
|
||||
public Guid TenantId { get; set; }
|
||||
public JsonElement FeatureFlags { get; set; } = JsonDefaults.Object();
|
||||
public JsonElement AdminFeatureFlags { get; set; } = JsonDefaults.Object();
|
||||
public JsonElement PublicConfig { get; set; } = JsonDefaults.Object();
|
||||
public DateTimeOffset CreatedAt { get; set; } = DateTimeOffset.UtcNow;
|
||||
public DateTimeOffset UpdatedAt { get; set; } = DateTimeOffset.UtcNow;
|
||||
}
|
||||
Reference in New Issue
Block a user