feat(ingestion): implement hybrid metadata verification form #34 #41
Reference in New Issue
Block a user
Delete Branch "feature/issue-34"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
This PR implements Issue #34: [UI/UX] Implement Hybrid Metadata Verification Form in Ingestion Modal.
Key Changes
BookIngestionModal.razorallowing users to editTitleandAuthorbefore final ingestion.IngestEbookCommandandIngestEbookCommandHandler.IBookStorageServiceand its implementation for managing EPUB and cover file storage.POST /api/library/ingestMinimal API endpoint with.DisableAntiforgery()to handle client-side JSON uploads.IBookStorageServiceregistration.Verification
Closes #34.
Automated review – please address the inline comments.
Consider adding XML documentation for
SaveCoverAsyncto clarify that anullreturn indicates no cover image.Adding an overload that accepts a Stream could improve memory usage for large files.
Document why the default
TenantIdis "global" and how multi‑tenant usage should override it.Returned
epubPathis a relative URL – confirm thatEbook.FilePathexpects this format.Replace
ToLower()comparison withString.Equals(..., StringComparison.OrdinalIgnoreCase)for case‑insensitive author lookup.EF Core will assign the Author Id after
SaveChangesAsync; the comment about needing to save can be removed.Consider wrapping only expected failure points in the catch block to avoid swallowing programming errors.
Include the original exception message in the error result for easier debugging.
Mutable record is fine for binding; add XML docs for each property to improve IDE help.
IBookStorageServiceis registered as Scoped. Since it only depends onIWebHostEnvironment, consider registering it as Singleton.Directory creation is lazy – ensure these folders are intended to be publicly served via wwwroot.
Method returns a relative path. Document that callers should treat this as a URL path.
Consider streaming the write operation for large files instead of loading the entire byte array.
Added additional services – confirm they are registered in DI.
verification-statevisibility logic looks correct.Placeholder SVG uses hard‑coded colors; consider using CSS variables for theme consistency.
IsIngestingflag correctly disables the Save button and shows loading state.SaveToLibrarycreatesIngestEbookRequest– ensure the server side endpoint matches this contract.After successful ingestion, consider navigating to the new book (uncomment navigation call).
ThrowingBookStorageServiceensures DI validation; include a clear exception message.HttpClient configuration now falls back to NavigationManager.BaseUri – good for local dev.
UseAntiforgery()appears twice; remove the duplicate call.Missing
using System.Security.Claims;– add it to compile.Endpoint
api/library/ingestcorrectly disables antiforgery and requires auth.