Skip to content

Replace single preference table with global_preferences and route_preferences#56

Merged
zlendo1 merged 4 commits into
developmentfrom
copilot/update-preference-schema-models
Nov 13, 2025
Merged

Replace single preference table with global_preferences and route_preferences#56
zlendo1 merged 4 commits into
developmentfrom
copilot/update-preference-schema-models

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Nov 13, 2025

Split the monolithic preference table into two specialized preference types: global user preferences and location-specific route preferences.

Schema Changes

Old:

preference: id, user_id, prompt

New:

global_preferences: id, user_id, prompt
route_preferences: id, user_id, prompt, from_latitude, from_longitude, to_latitude, to_longitude

Implementation

  • Models: Created GlobalPreference and RoutePreference with proper SQLAlchemy relationships
  • Services: Extracted preference logic into global_preference_service and route_preference_service
  • Migration: Drops preference table, creates both new tables with indexes and foreign keys
  • API: Updated /users/preferences endpoint to use global preferences; route search now queries global preferences for user context
  • Validation: Route preference coordinates validated with proper lat/lon bounds

Migration Impact

Existing preference data will be lost when migration runs. Users should export preferences before upgrading if data preservation is required.

All tests updated to use GlobalPreference model (84 passing).

Original prompt

This section details on the original issue you should resolve

<issue_title>Update the preference schema and models</issue_title>
<issue_description>- Two new schemas / models:

global_preferences:
- id
- user_id
- prompt
route_preferences:
- id
- user_id
- prompt
- from_latitude
- from_longitude
- to_latitude
- to_longitude
  • Apply previously implemented user preference logic for global_preferences.</issue_description>

<agent_instructions>Fix test compatibility due to change in preference to global_preference scheme.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits November 13, 2025 11:55
…actoring

Co-authored-by: zlendo1 <115471708+zlendo1@users.noreply.github.com>
Co-authored-by: zlendo1 <115471708+zlendo1@users.noreply.github.com>
Copilot AI changed the title [WIP] Update the preference schema and models Replace single preference table with global_preferences and route_preferences Nov 13, 2025
Copilot AI requested a review from zlendo1 November 13, 2025 12:01
@zlendo1 zlendo1 marked this pull request as ready for review November 13, 2025 14:15
@zlendo1 zlendo1 merged commit c26c114 into development Nov 13, 2025
1 check passed
@3nd3r1 3nd3r1 deleted the copilot/update-preference-schema-models branch November 17, 2025 14:47
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.

2 participants