forked from gongxuegit/tiku-backend.net
feat: add content navigation and tenant configuration
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using Tiku.Domain.Catalog;
|
||||
using Tiku.Domain.Content;
|
||||
using Tiku.Domain.Identity;
|
||||
using Tiku.Domain.QuestionBanks;
|
||||
|
||||
@@ -37,6 +38,7 @@ internal sealed class QuestionConfiguration : IEntityTypeConfiguration<Question>
|
||||
builder.Property(entity => entity.Type).HasMaxLength(50);
|
||||
builder.Property(entity => entity.TypeLabel).HasMaxLength(100);
|
||||
builder.Property(entity => entity.Tags).IsJson("[]");
|
||||
builder.Property(entity => entity.ExamMarkers).IsJson("{}");
|
||||
builder.Property(entity => entity.MediaUrl).HasMaxLength(2048);
|
||||
builder.Property(entity => entity.Status).HasSnakeCaseEnum();
|
||||
builder.HasIndex(entity => new { entity.TenantId, entity.LegacyId }).IsUnique();
|
||||
@@ -57,6 +59,18 @@ internal sealed class QuestionConfiguration : IEntityTypeConfiguration<Question>
|
||||
.HasForeignKey(entity => new { entity.TenantId, entity.NodeId })
|
||||
.HasPrincipalKey(entity => new { entity.TenantId, entity.Id })
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
builder.HasOne<ContentEntry>().WithMany()
|
||||
.HasForeignKey(entity => new { entity.TenantId, entity.EntryId })
|
||||
.HasPrincipalKey(entity => new { entity.TenantId, entity.Id })
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
builder.HasOne<ContentNode>().WithMany()
|
||||
.HasForeignKey(entity => new { entity.TenantId, entity.ContentNodeId })
|
||||
.HasPrincipalKey(entity => new { entity.TenantId, entity.Id })
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
builder.HasOne<QuestionCollection>().WithMany()
|
||||
.HasForeignKey(entity => new { entity.TenantId, entity.PrimaryCollectionId })
|
||||
.HasPrincipalKey(entity => new { entity.TenantId, entity.Id })
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
builder.HasOne<QuestionVersion>().WithMany()
|
||||
.HasForeignKey(entity => new { entity.TenantId, entity.Id, entity.CurrentVersionId })
|
||||
|
||||
Reference in New Issue
Block a user