sanhozay/PilotLog

No way to delete a completed flight

Opened this issue · 1 comments

The web interface does not provide a means to delete a flight.

The philosophy was originally that the log should be an indelible record of flights, so I never added a delete button. In practice there are times when I do want to delete flights.

The interim workaround is to make a note of the flight id from the flight detail page (click on the flight date in the flight record), then use this script. Note that deleted flights cannot be recovered, other than by restoring the H2 database from a backup.

#!/bin/sh

HOSTNAME=localhost

ECHO=/bin/echo
CURL=/usr/bin/curl

for id in "$@"
do
    $ECHO -n "Deleting flight $id - "
    $CURL -fsX DELETE http://$HOSTNAME:8080/api/flights/flight/$id > /dev/null
    if [ $? -eq 0 ]
    then
        $ECHO "ok"
    else
        $ECHO "failed"
    fi
done