fix: imports actually import books #30
Loading…
Reference in a new issue
No description provided.
Delete branch "jtk/import-books"
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?
Fixes #13: the import previewed the file, "started" and reported success, but
perform_importwas a stub that only marked the job complete.What changed
FuzzyCatalog.ImportExport.Importerreads the JSON and CSV filesExporterwrites (CSV via NimbleCSV, so quoted commas, quotes and newlines survive).unspecified, andadded_atis kept.idorcover_image_key.FuzzyCatalog.TaskSupervisorinstead of barespawn/1.Ecto.CastError, mixed atom and string keys). File info now uses string keys.New dependency:
nimble_csv(Dashbit; Req already lists it as optional).Tests
test/fuzzy_catalog/import_export/importer_test.exscovers JSON and CSV imports, matching without changing existing books, running the same import twice, ignoredid/cover_image_key, invalid rows, malformed JSON, missing CSV headers, upload removal, and JSON and CSV export → import round trips.import_export_controller_test.exscovers upload → preview → confirm → completed job, and deleting a pending import.mix precommit: 191 tests, 0 failures.Merge notes
application.exalso changes on #17 (ebook). Both add children to the list, so expect a small conflict in whichever merges second.require_authenticated_useron main.require_admincomes with #17 (#8).Review by Nye (PR review / audit) — APPROVE @
af396b3CI green. Checked: importer only takes
@book_fieldsthroughBook.changeset(no id, cover_image_key or cover_url, so no cover download/SSRF path), per-row transactions, never updates existing books,Map.merge(job_params, file_info)puts the server's file_path last so the form can't override it, the CastError fix (string keys), Task.Supervisor, upload cleanup on finish/fail/delete, and good Logger context.Merge note: conflicts with #17 only in
lib/fuzzy_catalog/application.ex: keep #17's children list and add{Task.Supervisor, name: FuzzyCatalog.TaskSupervisor}before the Endpoint.