StPfeffer / rusty-roads

A simple route manager application written in Rust
MIT License
0 stars 0 forks source link

Feature Request: Implement Route Status Scope #85

Closed StPfeffer closed 3 weeks ago

StPfeffer commented 3 weeks ago

Summary

Implement a comprehensive route status management document scope that includes database queries for INSERT, SELECT, and DELETE operations, as well as four API routes for retrieving a route status by ID, listing all route statuses, creating a new route status, and deleting a route status, all under the path /route/{routeId}/status.

Background

The current route status management system lacks a defined scope for handling route status data efficiently. This can lead to inconsistencies and difficulties in managing route status-related data. Establishing a clear route status document scope will streamline database operations and improve the API's functionality, making it easier for developers to work with route status data.

Objectives

  1. Database Operations: Define and implement database queries for inserting, selecting, and deleting route status documents.
  2. API Routes: Develop four API routes for managing route status documents: get by ID, list all, create, and delete.

Requirements

Database Operations

  1. INSERT Query:

    • Insert new route status records into the database.
    • Ensure data validation and integrity constraints are enforced.
  2. SELECT Query:

    • Retrieve route status records based on specified criteria.
    • Support querying by route status ID and other relevant attributes.
  3. DELETE Query:

    • Remove route status records from the database.
    • Ensure proper handling of dependencies and referential integrity.

API Routes

  1. Get Route Status by ID

    • Endpoint: GET /api/v1/route/{routeId}/status/{id}
    • Description: Retrieve details of a specific route status by its ID.
    • Response: JSON object containing route status details or an error message if the route status is not found.
  2. List All Route Statuses

    • Endpoint: GET /api/v1/route/{routeId}/status
    • Description: Retrieve a list of all route statuses.
    • Response: JSON array of route status objects.
  3. Create Route Status

    • Endpoint: POST /api/v1/route/{routeId}/status
    • Description: Create a new route status record.
    • Request Body: JSON object containing route status details.
    • Response: JSON object of the created route status or an error message if the creation fails.
  4. Delete Route Status

    • Endpoint: DELETE /api/v1/route/{routeId}/status/{id}
    • Description: Delete a specific route status by its ID.
    • Response: Success message or an error message if the deletion fails.

Implementation Plan

  1. Database Schema Design: Review and update the database schema to support route status document operations, ensuring all necessary fields and constraints are included.
  2. Query Development: Implement the INSERT, SELECT, and DELETE queries with proper validation and error handling.
  3. API Development: Develop the four API routes, ensuring they handle requests and responses correctly and integrate seamlessly with the database queries.
  4. Documentation: Update the API documentation to include detailed information about the new route status document scope, including endpoint descriptions, request/response formats, and examples.
  5. Testing: Perform thorough testing of the database operations and API routes to ensure they work as expected and handle edge cases gracefully.