Files
Nexus.Reader/src/NexusReader.Domain/Entities/Ebook.cs
T
Antigravity 5a2223a4c8 feat: Ingestion Pipeline Stabilization and WASM Service Proxies (#42)
This PR stabilizes the Nexus Ingestion Engine by implementing functional service proxies for the Blazor WASM client and refining the backend infrastructure for real-time progress tracking and database compatibility.

### Key Changes
- **Infrastructure Stabilization**:
  - Implemented production-grade `EbookRepository` with PostgreSQL `EF.Functions.ILike` support.
  - Enforced `IsReadyForReading = false` state for newly added ebooks (resolves #35).
  - Updated `SignalRSyncBroadcaster` to support targeted user messaging and ingestion-specific progress updates (resolves #37).
- **WASM Client Functional Proxies**:
  - Replaced "Throwing" dummy services with `WasmEbookRepository`, `WasmSyncBroadcaster`, `WasmBookStorageService`, and `WasmEmbeddingGenerator`.
  - These services proxy requests to the backend via a new set of Minimal API endpoints in `NexusReader.Web`.
- **Domain Refinement**:
  - Added `IsReadyForReading` flag to the `Ebook` entity to manage background AI processing states.

### Related Issues
- Fixes #35
- Fixes #36
- Fixes #37

---------

Co-authored-by: Marek Jasiński <jasins.marek@gmail.com>
Reviewed-on: #42
Co-authored-by: Antigravity <antigravity@google.com>
Co-committed-by: Antigravity <antigravity@google.com>
2026-05-13 18:24:24 +00:00

57 lines
1.4 KiB
C#

using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace NexusReader.Domain.Entities;
/// <summary>
/// Represents an E-book uploaded or owned by a user.
/// </summary>
public class Ebook
{
[Key]
public Guid Id { get; set; } = Guid.NewGuid();
[Required]
[MaxLength(255)]
public string Title { get; set; } = string.Empty;
[Required]
public int AuthorId { get; set; }
[ForeignKey(nameof(AuthorId))]
public virtual Author Author { get; set; } = null!;
[Required]
public string FilePath { get; set; } = string.Empty;
public string? CoverUrl { get; set; }
[Required]
[MaxLength(128)]
public string TenantId { get; set; } = "global";
public DateTime AddedDate { get; set; } = DateTime.UtcNow;
public DateTime? LastReadDate { get; set; }
public double Progress { get; set; } = 0;
[MaxLength(255)]
public string? LastChapter { get; set; }
public int LastChapterIndex { get; set; } = 0;
/// <summary>
/// Gets or sets a value indicating whether the ebook has been processed by the AI ingestion engine
/// and is ready for reading (Knowledge Units generated).
/// </summary>
public bool IsReadyForReading { get; set; } = false;
// Relationship to NexusUser
[Required]
public string UserId { get; set; } = string.Empty;
[ForeignKey(nameof(UserId))]
public NexusUser? User { get; set; }
}