feat(conversations): filter person typeahead to correspondents of selected person #42

Merged
marcel merged 1 commits from feat/29-correspondent-typeahead into main 2026-03-20 21:26:35 +01:00
Owner

Closes #29

Summary

  • New GET /api/persons/{id}/correspondents?q= endpoint returns the persons who share at least one document with the given person, ordered by number of shared documents descending, limited to 10
  • PersonTypeahead gains an optional restrictToCorrespondentsOf prop — when set, it fetches correspondents immediately on focus (no typing required) and uses the new endpoint for filtering while typing
  • Both person fields on /conversations pass each other's selected ID as restrictToCorrespondentsOf, so selecting Person A immediately restricts Person B's suggestions (and vice versa)

Test plan

  • ./mvnw test — 76 backend tests pass (3 new PersonServiceTest cases)
  • npm run test — 111 frontend tests pass (4 new PersonTypeahead correspondent-mode cases)
  • npm run lint && npm run check — no errors
  • Manual: select a person in the first field on /conversations, click the second field → dropdown opens immediately with their top correspondents
Closes #29 ## Summary - New `GET /api/persons/{id}/correspondents?q=` endpoint returns the persons who share at least one document with the given person, ordered by number of shared documents descending, limited to 10 - `PersonTypeahead` gains an optional `restrictToCorrespondentsOf` prop — when set, it fetches correspondents immediately on focus (no typing required) and uses the new endpoint for filtering while typing - Both person fields on `/conversations` pass each other's selected ID as `restrictToCorrespondentsOf`, so selecting Person A immediately restricts Person B's suggestions (and vice versa) ## Test plan - [ ] `./mvnw test` — 76 backend tests pass (3 new `PersonServiceTest` cases) - [ ] `npm run test` — 111 frontend tests pass (4 new `PersonTypeahead` correspondent-mode cases) - [ ] `npm run lint && npm run check` — no errors - [ ] Manual: select a person in the first field on `/conversations`, click the second field → dropdown opens immediately with their top correspondents
marcel added 1 commit 2026-03-20 21:24:00 +01:00
feat(conversations): filter person typeahead to correspondents of selected person
All checks were successful
CI / E2E Tests (push) Successful in 18m17s
CI / Unit & Component Tests (push) Successful in 3m37s
CI / Backend Unit Tests (push) Successful in 2m15s
CI / Unit & Component Tests (pull_request) Successful in 2m12s
CI / Backend Unit Tests (pull_request) Successful in 2m1s
CI / E2E Tests (pull_request) Successful in 15m17s
0525e66d55
Closes #29

Backend:
- Add PersonRepository.findCorrespondents / findCorrespondentsWithFilter
  (native SQL, orders by shared document count DESC, limit 10)
- Add PersonService.findCorrespondents(personId, q) delegating to the
  correct repository method based on whether a query string is present
- Expose GET /api/persons/{id}/correspondents?q= in PersonController

Frontend:
- Add optional restrictToCorrespondentsOf prop to PersonTypeahead
- On focus with the prop set, fetch correspondents immediately (no typing
  required) — opens the dropdown showing top correspondents
- On input with the prop set, hit the correspondents endpoint with q= param
- Without the prop, keep existing /api/persons?q= behaviour unchanged
- Wire the prop bidirectionally in /conversations: sender restricts receiver
  and vice versa

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
marcel merged commit 0525e66d55 into main 2026-03-20 21:26:35 +01:00
marcel deleted branch feat/29-correspondent-typeahead 2026-03-20 21:26:37 +01:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: marcel/familienarchiv#42