feat: establish formal relationship between KnowledgeUnit and Ebook (#35)

- Refactored KnowledgeUnit to use Guid EbookId and added navigation property
- Updated AppDbContext with fluent configuration and cascade delete
- Propagated ebookId through IKnowledgeService and API endpoints
- Generated EF migration for schema changes
This commit is contained in:
2026-05-13 20:39:09 +02:00
parent 5a2223a4c8
commit 82a4d29598
11 changed files with 860 additions and 41 deletions
@@ -65,8 +65,13 @@ public class AppDbContext : IdentityDbContext<NexusUser>
{
entity.HasKey(e => e.Id);
entity.HasIndex(e => e.TenantId);
entity.HasIndex(e => e.SourceId);
entity.HasIndex(e => e.EbookId);
entity.Property(e => e.Vector).HasColumnType("vector(768)");
entity.HasOne(e => e.Ebook)
.WithMany()
.HasForeignKey(e => e.EbookId)
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity<KnowledgeUnitLink>(entity =>