This PR finalizes the implementation of issue #35 by establishing a formal foreign key relationship between `KnowledgeUnit` and `Ebook`. Closes #35 ### Changes: - **Domain**: Refactored `KnowledgeUnit` to use `Guid EbookId` and added navigation property. - **Data**: Updated `AppDbContext` fluent configuration and generated a new migration. - **Service**: Updated `IKnowledgeService` and its implementations to propagate `ebookId`. - **API**: Updated Web API endpoints to support linking extracted knowledge to specific ebooks. ### Verification: - [x] Solution builds successfully (`dotnet build`). - [x] Schema changes verified in migration file. - [x] Cascading delete behavior confirmed. --------- Co-authored-by: Marek Jasiński <jasins.marek@gmail.com> Reviewed-on: #43 Co-authored-by: Antigravity <antigravity@google.com> Co-committed-by: Antigravity <antigravity@google.com>
This commit was merged in pull request #43.
This commit is contained in:
@@ -247,14 +247,12 @@ namespace NexusReader.Data.Migrations
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<Guid?>("EbookId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("MetadataJson")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("SourceId")
|
||||
.IsRequired()
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("character varying(128)");
|
||||
|
||||
b.Property<string>("TenantId")
|
||||
.IsRequired()
|
||||
.HasMaxLength(128)
|
||||
@@ -273,7 +271,7 @@ namespace NexusReader.Data.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SourceId");
|
||||
b.HasIndex("EbookId");
|
||||
|
||||
b.HasIndex("TenantId");
|
||||
|
||||
@@ -635,6 +633,16 @@ namespace NexusReader.Data.Migrations
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("NexusReader.Domain.Entities.KnowledgeUnit", b =>
|
||||
{
|
||||
b.HasOne("NexusReader.Domain.Entities.Ebook", "Ebook")
|
||||
.WithMany()
|
||||
.HasForeignKey("EbookId")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.Navigation("Ebook");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("NexusReader.Domain.Entities.KnowledgeUnitLink", b =>
|
||||
{
|
||||
b.HasOne("NexusReader.Domain.Entities.KnowledgeUnit", "SourceUnit")
|
||||
|
||||
Reference in New Issue
Block a user