Skip to content

Add route preference endpoints with test coverage#57

Merged
zlendo1 merged 2 commits into
developmentfrom
copilot/add-route-preference-endpoints
Nov 13, 2025
Merged

Add route preference endpoints with test coverage#57
zlendo1 merged 2 commits into
developmentfrom
copilot/add-route-preference-endpoints

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Nov 13, 2025

Implements separate REST endpoints for RoutePreference entities (create, list, delete) with comprehensive test coverage. The existing RoutePreference model, schema, and service were already in place but lacked HTTP endpoints.

Changes

New endpoints at /api/v1/users/route-preferences:

  • GET / - List all route preferences for authenticated user
  • POST / - Create route preference with prompt and coordinate pairs
  • DELETE /{id} - Delete specific route preference

Test coverage (30 new tests):

  • Endpoint tests: authentication, authorization, CRUD operations, coordinate validation
  • Service tests: business logic, user isolation, data integrity

Example Usage

# Create a route preference
POST /api/v1/users/route-preferences
{
  "prompt": "Prefer trains over buses",
  "from_latitude": 60.1699,
  "from_longitude": 24.9384,
  "to_latitude": 60.2055,
  "to_longitude": 24.6559
}

# Response: 201 Created
{
  "id": 1,
  "prompt": "Prefer trains over buses",
  "from_latitude": 60.1699,
  "from_longitude": 24.9384,
  "to_latitude": 60.2055,
  "to_longitude": 24.6559,
  "created_at": "2025-11-13T14:25:00Z"
}

Follows the same architectural pattern as GlobalPreference endpoints for consistency.

Original prompt

This section details on the original issue you should resolve

<issue_title>Create new route-specific preference endpoints in the backend</issue_title>
<issue_description>Add separate endpoints (and services) for adding, getting and deleting RoutePreference.</issue_description>

<agent_instructions>Implement tests for this issue.</agent_instructions>

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


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: zlendo1 <115471708+zlendo1@users.noreply.github.com>
Copilot AI changed the title [WIP] Add route-specific preference endpoints in the backend Add route preference endpoints with test coverage Nov 13, 2025
Copilot AI requested a review from zlendo1 November 13, 2025 14:33
@zlendo1 zlendo1 marked this pull request as ready for review November 13, 2025 14:42
@zlendo1 zlendo1 merged commit 05b651d into development Nov 13, 2025
2 checks passed
@3nd3r1 3nd3r1 deleted the copilot/add-route-preference-endpoints 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