feat: auto-persist metadata and chapter list on first book preview visit
Some checks failed
Deploy / Deploy Production (push) Has been skipped
Deploy / Cleanup Preview (push) Has been skipped
Deploy / Deploy Preview (push) Failing after 0s
CI / Scraper / Test (pull_request) Successful in 10s
CI / Scraper / Lint (pull_request) Successful in 19s
CI / UI / Build (pull_request) Successful in 20s
CI / Scraper / Build (pull_request) Successful in 10s

When a book is not in the local DB and the preview endpoint is hit,
metadata and the chapter index are now saved to PocketBase in the
background. Subsequent visits load from the local store instead of
scraping live. Chapter text is not fetched until an explicit scrape job
is triggered.
This commit is contained in:
Admin
2026-03-06 17:09:57 +05:00
parent c0d33720e9
commit b3358ac1d2
5 changed files with 56 additions and 0 deletions

View File

@@ -90,6 +90,10 @@ func (s *mockStore) WriteChapter(_ context.Context, slug string, ch scraper.Chap
return nil
}
func (s *mockStore) WriteChapterRefs(_ context.Context, _ string, _ []scraper.ChapterRef) error {
return nil
}
func (s *mockStore) WriteMetadata(_ context.Context, meta scraper.BookMeta) error {
s.mu.Lock()
defer s.mu.Unlock()