Commit Graph

35 Commits

Author SHA1 Message Date
Cameron
dc2a96162e fix(dates): prefer earliest of fs created/modified as fallback
On copied or restored files (e.g. a backup library), the OS stamps
created at copy time while modified is preserved from the source, so
the earlier of the two is a better proxy for when the content
originated. Adds utils::earliest_fs_time and threads it through the
three spots that fall back to filesystem dates: photos-list sort,
memories grouping, and insight-generation timestamp.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-23 17:20:12 -04:00
Cameron
2c8de8dcc6 feat: union /photos and /memories across libraries
When `library` is omitted, both endpoints now walk every configured
library root, interleave the results, and tag each row with its source
library via the parallel `photo_libraries` / per-row `library_id`
arrays. Previously the handlers fell back to the primary library,
silently hiding the rest.

Threads a parallel `file_libraries: Vec<i32>` through the sort/paginate
helpers so library attribution survives sorting and pagination.
Directory names are de-duplicated across libraries.

`get_all_with_date_taken` grows an optional library filter so memories
can scope its EXIF query per-library during the union walk.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 01:55:07 +00:00
Cameron
c2ee3996be chore: apply cargo fmt + clippy cleanup across crate
Silence forward-looking dead_code on unused DAO modules, annotate
individual placeholder items, rewrite tautological assert!(true/false)
in token tests as panic! arms, and pick up fmt drift.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 01:55:07 +00:00
Cameron
c01a0479b7 fix: honor library param in /image, /photos, /memories
The Phase 3 plumbing accepted `library=` but didn't actually route
requests through the scoped library once it was resolved. Three
concrete bugs surfaced when testing against a second mounted library:

- `/image` always resolved paths against AppState.base_path (primary),
  so thumbnails for non-primary libraries 400'd when their rel_paths
  didn't exist under primary. Now resolves against the scoped library
  and defaults to primary when the param is omitted.

- `/memories` walked the scoped library correctly but its helper
  functions hardcoded `library_id: PRIMARY_LIBRARY_ID` on every
  MemoryItem, causing clients to route thumbnails back to primary
  regardless of which library the memory actually came from.

- `/photos` non-recursive listing delegated to a `RealFileSystem`
  constructed from AppState.base_path at startup, so walks always
  hit primary even when `library=2` was passed. The non-primary
  path now uses list_files against the scoped library's root;
  primary still goes through FileSystemAccess to preserve the
  existing test mock plumbing.

Also adds `library` to ThumbnailRequest so the /image query param
is actually parsed.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-21 01:55:07 +00:00
Cameron
48e5de6eab feat: add GET /libraries and library query param plumbing
New `/libraries` endpoint returns configured libraries so clients can
discover them. `FilesRequest` and `MemoriesRequest` gain an optional
`library` param (accepts name or numeric id). Unknown values are
rejected with 400; absent values span all libraries. `/memories`
now scopes its filesystem walk + EXIF query to the resolved library.
`MemoryItem` carries `library_id` so union-mode clients can render a
per-item source badge.

Behavior is unchanged in single-library mode: omitting `library` still
returns results from the primary library, which is the only one
configured until a second row is added to the libraries table.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-21 01:55:07 +00:00
Cameron
7d2a3148bb Make Memories week span sorting chronological 2026-01-26 20:51:11 -05:00
Cameron
e2d6cd7258 Run clippy fix 2026-01-14 13:17:58 -05:00
Cameron
b2cc617bc2 Pass image as additional Insight context 2026-01-10 11:30:01 -05:00
Cameron
0dfec4c8c5 Fix memory filename date extraction 2026-01-02 19:29:42 -05:00
Cameron
2d02f00e7d Fix Memories Week span sorting 2025-12-29 18:49:52 -05:00
Cameron
9cb923df9e Fix memory date priority 2025-12-29 12:28:17 -05:00
Cameron
be281130d5 Send timestamp from filename for Memories endpoint 2025-12-25 23:32:00 -05:00
Cameron
c0021734b6 Try fixing Otel span propogation 2025-12-24 10:17:14 -05:00
Cameron
c1cfda9df9 Fix memories week span sorting 2025-12-24 00:27:44 -05:00
Cameron
c035678162 Add tracing to EXIF DAO methods 2025-12-23 22:57:24 -05:00
Cameron
df94010d21 Fix tests and improve memories date error log 2025-12-19 14:20:51 -05:00
Cameron
eb8e08b9ff Add EXIF search infrastructure (Phase 1 & 2)
Implements foundation for EXIF-based photo search capabilities:

- Add geo.rs module with GPS distance calculations (Haversine + bounding box)
- Extend FilesRequest with EXIF search parameters (camera, GPS, date, media type)
- Add MediaType enum and DateTakenAsc/DateTakenDesc sort options
- Create date_taken index migration for efficient date queries
- Implement ExifDao methods: get_exif_batch, query_by_exif, get_camera_makes
- Add FileWithMetadata struct for date-aware sorting
- Implement date sorting with filename extraction fallback
- Make extract_date_from_filename public for reuse

Next: Integrate EXIF filtering into list_photos() and enhance get_all_tags()
2025-12-18 09:34:07 -05:00
Cameron
c7fd328925 Check Exif DB for memory collection 2025-12-17 22:10:23 -05:00
Cameron
3c894335ce Added file date format for memories 2025-12-01 13:51:17 -05:00
Cameron
f02a858368 Bump to 0.3.1 and format/clippy 2025-12-01 13:04:55 -05:00
Cameron
a7d065aadc Tests and improved pattern-excluding behavior 2025-12-01 12:54:40 -05:00
Cameron
f5c53d1e0e Allow for pattern-based memories folder exclusion 2025-12-01 12:29:32 -05:00
Cameron
273b877e16 Update to Rust 2024 edition
Formatted code.
2025-09-01 13:36:27 -04:00
Cameron
2cc4124544 Just look for date format instead of screenshot text 2025-09-01 11:15:27 -04:00
Cameron
6f76a74b2e Add additional memories filename regex 2025-09-01 11:09:09 -04:00
Cameron
9c04fcb1d1 Add additional memories filename regex 2025-09-01 11:01:01 -04:00
Cameron
e46953194e Allow for excluding directories from Memories endpoint 2025-08-27 16:02:32 -04:00
Cameron
34784a39f6 Use rayon for memories endpoint 2025-08-21 16:39:33 -04:00
Cameron
93957bf389 Refactor date parsing from filename by introducing reusable closure, remove redundant logging level, and simplify regex logic. 2025-08-15 23:20:07 -04:00
Cameron
7dcf89c47e Add conditional sorting logic for Month span in memories sorting 2025-08-15 17:22:01 -04:00
Cameron
4315744abb Improve Memory sorting 2025-08-13 13:23:32 -04:00
Cameron
85093ff0c7 Add parsing date from filename for memories 2025-08-12 20:55:22 -04:00
Cameron
8d9a5fd79f Try adding timezone awareness 2025-08-11 17:11:02 -04:00
Cameron
88114ef4d4 Add Month memory filter span 2025-08-09 22:46:25 -04:00
Cameron
caed787c04 Add /memories endpoint 2025-08-09 22:24:48 -04:00