Skip to content
Snippets Groups Projects
Commit 0cd72a9e authored by Petr Kabourek's avatar Petr Kabourek
Browse files

add basic showcase

parent 46c4f9b8
No related branches found
No related tags found
No related merge requests found
Pipeline #
#/bin/bash
echo "We will first register new pilot:"
PILOT_ID=$(curl -X POST "http://localhost:8080/employee/pilot" -H "accept: */*" -H "Content-Type: application/json" -d "{ \"dateOfBirth\": \"2024-05-22\", \"gender\": true, \"licences\": [ \"AIRBUS_A310\", \"CESSNA\" ], \"name\": \"Robert\", \"surname\": \"Letadlo\"}" |\
jq -r '.id')
echo "Then, we need to register a plane for our new pilot:"
PLANE_ID=$(curl -X POST "http://localhost:8082/plane" -H "accept: */*" -H "Content-Type: application/json" -d "{ \"maxCapacity\": 5, \"name\": \"Kamikaze\", \"pilotsRequired\": 1, \"planeType\": \"CESSNA\"}" |\
jq -r '.id')
echo "Then we need an airport to fly to"
SRC_AIRPORT=$(curl -X POST "http://localhost:8081/airport" -H "accept: */*" -H "Content-Type: application/json" -d "{ \"capacity\": \"1000\", \"city\": \"Brno\", \"country\": \"Czechia\", \"landingPrice\": 100, \"latitude\": 10, \"longitude\": 10, \"name\": \"Letiste Turany\"}" |\
jq -r '.id')
echo "Then we need an airport to fly to":
DEST_AIRPORT=$(curl -X POST "http://localhost:8081/airport" -H "accept: */*" -H "Content-Type: application/json" -d "{ \"capacity\": \"10000\", \"city\": \"Praha\", \"country\": \"Czechia\", \"landingPrice\": 10000, \"latitude\": 25, \"longitude\": 100, \"name\": \"Letiste Ruzyne\"}" |\
jq -r '.id')
echo "Then we can register a plan for the flight":
echo "our values are: Pilot: ${PILOT_ID}, Plane: ${PLANE_ID}, Source Airport: ${SRC_AIRPORT}, Dest Airport: ${DEST_AIRPORT}"
FLIGHT_ID=$(curl -X POST "http://localhost:8083/flights" -H "accept: */*" -H "Content-Type: application/json" -d "{ \"destination\": \"${DEST_AIRPORT}\", \"origin\": \"${SRC_AIRPORT}\", \"pilotIds\": [ \"${PILOT_ID}\" ], \"planeId\": \"${PLANE_ID}\", \"stewardIds\": []}" |\
jq -r '.id')
echo "Flight id is ${FLIGHT_ID}"
echo "Lastly we record the details after the flight":
curl -X POST "http://localhost:8083/flightrealization" -H "accept: */*" -H "Content-Type: application/json" -d "{ \"arrivalTime\": \"2024-05-22T11:04:32.609Z\", \"departureTime\": \"2024-05-22T11:04:32.609Z\", \"duration\": { \"seconds\": 36000 }, \"flightId\": \"${FLIGHT_ID}\", \"kilometersFlown\": 250, \"report\": \"All good, minor technical difficulties\"}"
echo "If we encountered some difficulties, we can also report them:"
curl -X POST "http://localhost:8083/issuereports" -H "accept: */*" -H "Content-Type: application/json" -d "{ \"description\": \"Weird sound while extending flaps\", \"flightEncountered\": \"${FLIGHT_ID}\", \"planeId\": \"${PLANE_ID}\"}"
echo "Lastly we can check the details about the flight we just made:"
curl -X GET "http://localhost:8083/flights/${FLIGHT_ID}" -H "accept: */*"
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment