Skip to content

add CRUD operations for routes (DEV-58)#24

Open
ivymxu wants to merge 2 commits intomainfrom
feature/DEV-58/routes-crud
Open

add CRUD operations for routes (DEV-58)#24
ivymxu wants to merge 2 commits intomainfrom
feature/DEV-58/routes-crud

Conversation

@ivymxu
Copy link

@ivymxu ivymxu commented Mar 8, 2026

Jira ticket link

Jira ticket

Implementation description

  • Added CRUD for the Routes resource

Steps to test

  1. Navigate to http://localhost:8000/docs
  2. Create a route via POST /routes with a valid payload
  3. List routes via GET /routes, confirm the new route appears
  4. Get by ID via GET /routes/{route_id}, confirm 200 returned, try a fake ID and confirm 404
  5. Update via PUT /routes/{route_id}, confirm fields update, submit an empty body {} and confirm 400
  6. Delete via DELETE /routes/{route_id}, confirm 204, retry the same ID and confirm 404

What should reviewers focus on?

  • Empty update payload update_route / update_agency raise ValueError("No update fields were provided.") rather than silently no-oping
  • Datetime normalization in create_route], check that timezone-aware datetimes are converted to UTC and stripped before persistence

Checklist

Format for branch, commit, and PR title: docs/GIT.md.

  • My branch name includes the Jira ticket key
  • My PR name is descriptive and in imperative tense
  • My PR name includes the Jira ticket key
  • My commit messages are descriptive and in imperative tense. My commits are atomic and trivial commits are squashed or fixup'd into non-trivial commits
  • My commit messages include the Jira ticket key
  • I have run the appropriate linter(s)
  • I have requested a review from the PL, as well as other devs who have background knowledge on this PR or who will be building on top of this PR

Copilot AI review requested due to automatic review settings March 8, 2026 18:30
@ivymxu ivymxu force-pushed the feature/DEV-58/routes-crud branch from 124fd51 to 8f5cd1f Compare March 8, 2026 18:33
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR implements full CRUD support for the Routes resource in the FastAPI backend and refactors Agencies to follow the same service-layer pattern, plus some minor import/formatting cleanups across the repo.

Changes:

  • Implemented Routes CRUD endpoints and added a route_service business-logic layer.
  • Refactored Agencies endpoints to use a new agency_service business-logic layer with consistent error handling and empty-update validation.
  • Performed minor import ordering/formatting adjustments in backend modules and migrations.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
frontend/app/page.tsx Removes an extraneous blank line in the home page layout.
backend/setup.py Reorders setuptools imports.
backend/server.py Adds a blank line between stdlib and third-party imports.
backend/migrations/versions/2adf14c14d9c_initial.py Reorders imports in migration.
backend/migrations/versions/20260215_hafb_tables.py Reorders imports in migration.
backend/migrations/versions/20260215_complete_schema_redesign.py Reorders imports in migration.
backend/migrations/env.py Adjusts import ordering for settings/models registration.
backend/app/services/routes.py New: service layer implementing list/get/create/update/delete for routes incl. datetime normalization.
backend/app/services/agencies.py New: service layer implementing CRUD operations for agencies incl. empty-update validation and IntegrityError handling.
backend/app/services/init.py New: service package exports (agency_service, route_service).
backend/app/models/base.py Import formatting changes only.
backend/app/models/init.py Import formatting changes only.
backend/app/main.py Import ordering cleanup.
backend/app/database.py Import formatting cleanup.
backend/app/config.py Import ordering cleanup.
backend/app/api/routes.py Implements full CRUD endpoints for routes, delegating to route_service.
backend/app/api/agencies.py Refactors endpoints to delegate to agency_service and adds consistent error handling / 204 response.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ivymxu ivymxu force-pushed the feature/DEV-58/routes-crud branch from 8f5cd1f to 365fb80 Compare March 8, 2026 19:11
@ivymxu ivymxu marked this pull request as ready for review March 10, 2026 00:54
@ivymxu ivymxu requested a review from kenzysoror March 10, 2026 00:54
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