mirror of
https://github.com/bookorbit/bookorbit.git
synced 2026-11-03 00:11:37 -06:00
17aa7425f8
* feat(scanner): set book added_at from earliest on-disk file mtime A book's "date added" now reflects when its content files first landed on disk (the earliest mtime across its content-role files) instead of the moment BookOrbit imported it. Cover/metadata/supplement sidecars are excluded. When no content file has a usable mtime, addedAt is left unset so the DB defaultNow() fallback (import time) still applies. Only set at initial book creation; re-scan/restore paths do not touch it. * feat(library): add per-library added_at source with recompute Add an addedAtSource setting to libraries so "date added" can follow the book's files on disk rather than the moment the scanner happened to see them. The setting takes imported (unchanged default), file_modified, or file_created, guarded by a check constraint on the column. Expose a recompute action so the chosen source can be applied to books that are already imported. file_modified runs as a single set-based update over the stored mtimes; file_created has to stat the files, since birthtime is not persisted, so it batches those reads. Leave every existing library on imported so behavior is unchanged unless a user opts in. * feat(library): add added_at source control to the library editor Surface the new addedAtSource setting in the library editor as a radio group, alongside a button that triggers the recompute for the library being edited. Keep the recompute out of the save path so changing the setting stays cheap: the setting alone only affects books imported from then on, and applying it to existing books is an explicit choice. * i18n(library): translate added_at source strings (de/nl/pt/sl) * fix(library): correct create payload, recompute floor and failure logging The library creator posts its whole form, so omitting addedAtSource from CreateLibraryDto made the global whitelist reject every create request with a 400. Declare the field, validate it against the same source list as the update DTO, and persist it so the initial scan uses the requested source rather than silently falling back to imported. Apply the scanner's usable-time floor to the mtime recompute query too. It previously excluded only NULL, so a filesystem reporting epoch 0 would rewrite added_at to 1970 instead of leaving the import time in place. The floor now lives in library.constants rather than being spelled out twice. Wrap the recompute in try/catch so a database or stat failure emits the [fail] log the logging conventions require instead of propagating with only a [start] line recorded. * fix(library): gate recompute on the saved source and label the radios The recompute button stayed enabled while the selected source differed from the stored one. Because the request carries no source, clicking it recomputed against the old stored value while the UI showed the new selection. A hint already said to save first; disable the control as well so the mismatch is not actionable. Give the source list radiogroup semantics with aria-checked so screen readers can tell which option is active, since selection was conveyed by styling alone. * test(library): assert the create DTO under the real validation options The previous comment claimed the case exercised whitelist and forbidNonWhitelisted, but the shared helper calls validate without them, so it only proved @IsIn rejects an unknown value. Drop the misleading comment and add a case that validates with the same options main.ts gives ValidationPipe, so an undeclared addedAtSource fails the way it would in a real request. * docs(library): remove redundant date-added documentation --------- Co-authored-by: Bob Bobber <user@example.com> Co-authored-by: neon <18559658+neonsolstice@users.noreply.github.com>
BookOrbit - Client
Vue 3 SPA built with Vite and Tailwind CSS v4.
Running
From the repo root: pnpm dev (starts both server and client).
Client only: pnpm dev (from this directory). Runs at http://localhost:5173.
The Vite dev server proxies /api and /socket.io requests to the backend at localhost:3000.
IDE setup
- VS Code: Install the Vue (Official) extension. Disable Vetur if installed.
- WebStorm / IntelliJ: Vue support is built in. Enable TypeScript service for
.vuefiles. - Browser: Install Vue.js devtools and enable Custom Object Formatters in DevTools settings.
Project layout
src/
├── features/ Feature modules (one folder per domain)
│ ├── auth/ Login, registration, password reset
│ ├── book/ Book detail, covers, metadata
│ ├── library/ Library management
│ ├── collection/ Book collections
│ ├── smart-scope/ Saved search views
│ ├── scanner/ Scan progress UI
│ ├── reader/ Book reader (epub, pdf, cbz)
│ ├── settings/ User settings
│ └── admin/ Admin panel (users, roles, settings)
├── components/ Shared components (header, sidebar, icons)
│ └── ui/ Reusable UI primitives (button, dialog, etc.)
├── composables/ Global composables
├── views/ Route-level page components
├── router/ Vue Router config and guards
├── lib/ Utilities (api client, helpers)
├── stores/ Pinia stores (theme only - prefer composables)
└── assets/ CSS, fonts, static assets
Testing
pnpm test:unit # run unit tests
pnpm test:cov # run unit tests with coverage
Key conventions
- All components use
<script setup lang="ts">(Composition API only). - Feature state lives in composables (
features/<name>/composables/use*.ts), not global stores. - HTTP calls use the native
fetchAPI viasrc/lib/api.ts. - Styling with Tailwind CSS v4 utility classes. Theme tokens are CSS variables in
src/assets/main.css. - Icons from
@lucide/vueonly. - Shared types imported from
@bookorbit/types.