feat: checkbox batch trip delete on the Pi (local-only)

- Pi history page gets a select checkbox column + 'Delete selected' button
  (mirrors the server UI)
- POST /api/trips/delete batch endpoint
- app_sql.delete_trips_batch() + deleted_trip_markers table so a later trip
  rebuild can't resurrect locally-deleted trips
- Deletion is local-only: raw tracking rows are kept and the remote server
  is never notified (it keeps its archival copy recomputed from uploaded rows)
This commit is contained in:
Mathieu Moran
2026-08-15 16:55:30 -04:00
parent c9d36cca33
commit 99035e86ee
4 changed files with 85 additions and 2 deletions
+13
View File
@@ -232,6 +232,19 @@ def api_delete_trip(trip_id):
return jsonify(error=f"Trip not found: {trip_id}"), 404
return jsonify(status="deleted"), 200
@app.route('/api/trips/delete', methods=['POST'])
def api_delete_trips_batch():
"""Batch-delete computed trips on the Pi only (local archival cleanup).
The remote server is NOT told — it keeps its own archival copy of every
trip, recomputed from the uploaded tracking rows."""
body = request.get_json(silent=True) or {}
ids = body.get("ids")
if not isinstance(ids, list) or not ids:
return jsonify(error="expected {ids: [...]}"), 400
deleted = app_sql.delete_trips_batch(ids)
return jsonify(status="deleted", deleted=deleted), 200
import functools
import reverse_geocoder as rg