Performs a logical deletion of a driver record. This operation marks the driver and all associated records as deleted without physically removing them from the database.
{ "success": false, "message": "No se puede eliminar el motorista porque tiene misiones activas asignadas. Debe completar o reasignar las misiones antes de eliminar el motorista.", "data": null}
Since deletion is logical, deleted driver records can potentially be recovered by database administrators if needed. The deleted records remain in the database with a deletion flag.
// 1. Check if driver has active missionsconst driver = await fetch('/motorista/123');// 2. If missions exist, complete or reassign them firstif (driver.hasActiveMissions) { // Complete missions or reassign to another driver}// 3. Delete the driverconst response = await fetch('/motorista/123', { method: 'DELETE'});if (response.success) { console.log('Driver deleted successfully');}