StPfeffer / rusty-roads

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

Feature Request: Implement Route Scope #82

Closed StPfeffer closed 3 weeks ago

StPfeffer commented 1 month ago

Description

Implementation of the vehicle document scope.

Endpoints

Method Endpoint Description
GET /api/v1/routes List all the routes.
GET /api/v1/routes/:routeId Returns the route referring to the given ID.
POST /api/v1/routes Creates a route.
DELETE /api/v1/routes/:routeId Deletes the route referring to the entered ID.

Payloads

List all routes

Response
{
    "routes": [
        {
            "id": "229b492c-06a0-4590-8ef5-ab75cd0f9e75",
            "startedAt": "2024-06-04T01:48:32.884038",
            "endedAt": null,
            "totalDistance": "0",
            "createdAt": "2024-06-04T01:48:32.884038",
            "updatedAt": "2024-06-04T01:48:32.884038",
            "initialLat": "-24.95564670",
            "initialLong": "-53.46622770",
            "finalLat": null,
            "finalLong": null,
            "initialAddressId": null,
            "finalAddressId": null,
            "vehicleId": "b87d1704-c957-4ee2-b378-f7be43c10b85"
        }
    ],
    "results": 1
}

Get a route

Response
{
    "id": "229b492c-06a0-4590-8ef5-ab75cd0f9e75",
    "startedAt": "2024-06-04T01:48:32.884038",
    "endedAt": null,
    "totalDistance": "0",
    "createdAt": "2024-06-04T01:48:32.884038",
    "updatedAt": "2024-06-04T01:48:32.884038",
    "initialLat": "-24.95564670",
    "initialLong": "-53.46622770",
    "finalLat": null,
    "finalLong": null,
    "initialAddressId": null,
    "finalAddressId": null,
    "vehicleId": "b87d1704-c957-4ee2-b378-f7be43c10b85"
}

Create a route

Request
{
    "initialLat": "-24.9556467",
    "initialLong": "-53.4662277",
    "finalLat": null,
    "finalLong": null,
    "initialAddressId": null,
    "finalAddressId": null,
    "vehicleId": "b87d1704-c957-4ee2-b378-f7be43c10b85"
}
Response
{
    "id": "229b492c-06a0-4590-8ef5-ab75cd0f9e75",
    "startedAt": "2024-06-04T01:48:32.884038",
    "endedAt": null,
    "totalDistance": "0",
    "createdAt": "2024-06-04T01:48:32.884038",
    "updatedAt": "2024-06-04T01:48:32.884038",
    "initialLat": "-24.95564670",
    "initialLong": "-53.46622770",
    "finalLat": null,
    "finalLong": null,
    "initialAddressId": null,
    "finalAddressId": null,
    "vehicleId": "b87d1704-c957-4ee2-b378-f7be43c10b85"
}

Delete a route

Response
{
    "id": "3264f0d1-e8fd-43be-b7b0-a6b14afc779b",
    "startedAt": "2024-06-04T01:46:06.917895",
    "endedAt": null,
    "totalDistance": "0",
    "createdAt": "2024-06-04T01:46:06.917895",
    "updatedAt": "2024-06-04T01:46:06.917895",
    "initialLat": "-24.95564670",
    "initialLong": "-53.46622770",
    "finalLat": null,
    "finalLong": null,
    "initialAddressId": null,
    "finalAddressId": null,
    "vehicleId": "b87d1704-c957-4ee2-b378-f7be43c10b85"
}

Type of change

Checklist