Files
itroi/populate.fish
T
2025-12-17 12:37:39 +02:00

93 lines
1.9 KiB
Fish
Executable File

#!/usr/bin/env fish
function publish_correct
set vehicle '{
"id": 444,
"brand": "test vehicle",
"model": "test vehicle",
"license_plate": "AB4444AB",
"year": 1980,
"capacity_kg": 3321,
"status": "AVAILABLE"
}'
set freight1 '{
"id": 444,
"name": "test freight",
"description": "test freight",
"weight_kg": 444,
"dimensions": {
"width_cm": 4,
"height_cm": 4,
"length_cm": 4
},
"status": "PENDING"
}'
set freight2 '{
"id": 555,
"name": "test freight 2",
"description": "test freight 2",
"weight_kg": 555,
"dimensions": {
"width_cm": 8,
"height_cm": 8,
"length_cm": 8
},
"status": "IN_TRANSIT"
}'
set route '{
"id": 444,
"vehicle_id": 1,
"freight_id": [
1, 2
],
"start_location": "string",
"end_location": "string",
"distance_km": 0.1,
"estimated_duration_hours": 0.1,
"status": "PLANNED"
}'
printf '\n\n'
curl -X POST http://localhost:8081/vehicles \
-H "Content-Type: application/json" \
-d $vehicle
printf '\n\n'
curl -X POST http://localhost:8080/freights \
-H "Content-Type: application/json" \
-d $freight1
printf '\n\n'
curl -X POST http://localhost:8080/freights \
-H "Content-Type: application/json" \
-d $freight2
printf '\n\n'
curl -X POST http://localhost:8082/routes \
-H "Content-Type: application/json" \
-d $route
end
function add_invalid_route
set route '{
"id": 444,
"vehicle_id": 444,
"freight_id": [
1, 2
],
"start_location": "string",
"end_location": "string",
"distance_km": 0.1,
"estimated_duration_hours": 0.1,
"status": "PLANNED"
}'
curl -X POST http://localhost:8082/routes \
-H "Content-Type: application/json" \
-d $route
end