Skip to content

Conversation

@VidurShah
Copy link
Collaborator

Implemented address autocomplete component for frontend with full backend API integration. This allows both student and police views to search for addresses with real-time suggestions from Google Maps Places API.

Changes:

Backend:

  • Added POST /locations/autocomplete endpoint in location_router.py that accepts { "address": string } and returns autocomplete suggestions
  • Created AutocompleteInput Pydantic model for request validation
  • Implemented location_router_test.pywith 7 tests covering success cases, validation, authentication, and error handling
  • All routes require user authentication (student or police role)

Frontend:

  • Created LocationService in locationService.ts to wrap the autocomplete API call using POST requests
  • Built AddressSearch component with:
    • Debounced search input (300ms delay)
    • Dropdown suggestions that appear as user types
    • Address selection that locks the input field
    • Clear button (X icon) to reset selection
    • Loading and error states
    • Uses Shadcn UI components (Command, Popover, Input, Button)

Component integrated with mock client for development

Also, changed /backend/scripts/reset_dev.py to match what is in the database - SQLAlchemy fixed itself after that for me, and dev container works appropriately now.

Closes #41

@VidurShah VidurShah requested a review from naasanov November 11, 2025 21:23
@github-actions
Copy link

github-actions bot commented Nov 11, 2025

Test Results Summary

260 tests  +7   260 ✅ +7   6s ⏱️ -1s
  1 suites ±0     0 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit 9ed46e9. ± Comparison against base commit 412eabe.

♻️ This comment has been updated with latest results.

This was referenced Nov 11, 2025
Copy link
Collaborator

@naasanov naasanov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. Dropdown feels way more consistent now. All I saw was that the party reg form also needed a default, so I just added that myself for time's sake. Thanks!

@naasanov naasanov merged commit 2ee25e5 into main Nov 18, 2025
2 checks passed
@naasanov naasanov deleted the vidur-issue-41 branch November 18, 2025 04:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Address Autocomplete Component & Route

3 participants