feat: add delete library and book functionality (#52) #54

Closed
mik-tf wants to merge 0 commits from development_delete_library_book into development
Owner

Summary

Add web UI and API endpoints to fully remove a library or book from the system.

What it does

Delete Library

  • "Delete Library" button on library page with Bootstrap confirmation modal
  • POST /library/{namespace}/delete API endpoint
  • Cleans up: disk directory, book TOMLs, embedder KVS keys, embedder namespace vectors, in-memory cache

Delete Book

  • Trash icon per book in the books table with confirm() dialog
  • POST /library/{namespace}/book/{book}/delete API endpoint
  • Cleans up: book export directory, KVS entry, PDF cache files

Files changed

File Change
src/embedder/client.rs Added delete_namespace() wrapper (SDK already had namespace_delete)
src/library.rs Made KVS_NAMESPACE and KVS_LIB_PREFIX pub(crate)
src/web/server.rs Added delete_library(), delete_book(), remove_namespace(), toml_belongs_to_library()
src/web/axum_server.rs Added routes + handlers following existing handler_pdf_delete pattern
templates/library.html Delete library button + modal, per-book delete button, JS functions

Scope decisions

  • Library delete purges entire embedder namespace (library = namespace)
  • Book delete cleans disk + KVS but does not purge individual vectors (would need SDK enhancement for prefix-based deletion; orphaned vectors are harmless)
  • No CLI commands or RPC methods — REST endpoints serve the UI and can be called programmatically

Fixes #52

## Summary Add web UI and API endpoints to fully remove a library or book from the system. ## What it does ### Delete Library - "Delete Library" button on library page with Bootstrap confirmation modal - `POST /library/{namespace}/delete` API endpoint - Cleans up: disk directory, book TOMLs, embedder KVS keys, embedder namespace vectors, in-memory cache ### Delete Book - Trash icon per book in the books table with `confirm()` dialog - `POST /library/{namespace}/book/{book}/delete` API endpoint - Cleans up: book export directory, KVS entry, PDF cache files ## Files changed | File | Change | |------|--------| | `src/embedder/client.rs` | Added `delete_namespace()` wrapper (SDK already had `namespace_delete`) | | `src/library.rs` | Made `KVS_NAMESPACE` and `KVS_LIB_PREFIX` pub(crate) | | `src/web/server.rs` | Added `delete_library()`, `delete_book()`, `remove_namespace()`, `toml_belongs_to_library()` | | `src/web/axum_server.rs` | Added routes + handlers following existing `handler_pdf_delete` pattern | | `templates/library.html` | Delete library button + modal, per-book delete button, JS functions | ## Scope decisions - **Library delete** purges entire embedder namespace (library = namespace) - **Book delete** cleans disk + KVS but does not purge individual vectors (would need SDK enhancement for prefix-based deletion; orphaned vectors are harmless) - No CLI commands or RPC methods — REST endpoints serve the UI and can be called programmatically Fixes #52
feat: add delete library and delete book functionality
Some checks failed
Test / test (pull_request) Failing after 3m38s
Test / integration (pull_request) Has been skipped
7316e5bad9
Add web UI and API endpoints to fully remove a library or book from the
system. Deletion cleans up all data locations:

- Disk: ~/hero/var/books/{library}/ directory
- Book TOMLs in books_dir matching the library namespace
- Embedder KVS: library_config:* and book:* keys
- Embedder vectors: namespace deletion via namespace.delete RPC
- In-memory namespace map
- PDF cache files (book delete)

UI: Delete Library button with confirmation modal on library page,
per-book delete button with confirm() in the books table.

API: POST /library/{namespace}/delete
     POST /library/{namespace}/book/{book}/delete

Fixes #52
fix: move delete UI to admin panel, fix cache refresh
Some checks failed
Test / test (pull_request) Failing after 3m37s
Test / integration (pull_request) Has been skipped
612a405610
- Remove delete buttons from library.html (too prominent for browsing)
- Add delete functionality to admin panel with Bootstrap modal confirmation
- Delete button inline in accordion header + sidebar trash icons
- Refresh books cache after delete so admin UI updates immediately
- Errors display in-modal instead of browser alert()
- Fix: use loadStats() instead of non-existent refreshStats()
fix: resolve clippy warnings in delete functions
All checks were successful
Test / test (pull_request) Successful in 3m0s
Test / integration (pull_request) Successful in 6m12s
559106f5c9
Collapse nested if statements and replace map_or with is_some_and
per clippy::collapsible_if and clippy::unnecessary_map_or lints.
Author
Owner

Closing: all changes from this PR are already present in development branch (verified via git merge-base --is-ancestor). Work consolidated into a new PR covering build system alignment and remaining features.

Closing: all changes from this PR are already present in `development` branch (verified via `git merge-base --is-ancestor`). Work consolidated into a new PR covering build system alignment and remaining features.
mik-tf closed this pull request 2026-02-19 01:10:53 +00:00
All checks were successful
Test / test (pull_request) Successful in 3m0s
Test / integration (pull_request) Successful in 6m12s

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_books!54
No description provided.