feat(pickers): thin lookup rows per resource, ordered by last use - #270
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
GET /trips/lookup,/dive-sites/lookup,/contacts/lookup,/people/lookup,/courses/lookupand/gear-items/lookupbeside the list routes. Each returns thin<Model>LookupItemrows: uuid and name, plus the locality for a site, the address for a contact, the username for a person, and brand, type, rented and archived for gear. Search matches what the list matches, and archived gear is never listed. Rows are ordered by the latest live dive naming the item at or beforeuntil, then by never-used items newest first, then by name and id.untilaccepts any shape a form holds (a time with an offset, a time without one, or a bare date) and is normalised to one UTC instant, a date counting to the end of its day. That ordering is a new API contract for the web pickers, and the list routes are unchanged. Cache: each lookup is cached under its resource's existing list prefix as new keys, with:lookup:until_{until}after the colon, so the existing sweeps drop them. The people lookup is uncached, as the people list is. Contacts and courses now rank by dives, so dive create, patch, delete and merge also drop the contact and course caches. No schema change and no deploy-skew shim: the routes are additive.Verified with the full suite (Postgres-backed tests running), coverage, ruff, mdformat,
alembic checkand all three mypy runs.🤖 Generated with Claude Code