feat(patient): implement doctor-only patient deletion, alert theme styling, and test auto-cleanup

This commit is contained in:
=
2026-09-22 13:41:14 -04:00
parent 73b69722a0
commit 654a7f402d
10 changed files with 616 additions and 16 deletions
@@ -61,4 +61,18 @@ class PatientService {
throw Exception('Error al actualizar paciente: $e');
}
}
Future<void> deletePatient(int id) async {
try {
final response = await apiClient.dio.delete('/items/pacientes/$id');
if (response.statusCode != 200 && response.statusCode != 204) {
throw Exception('Error en el servidor al eliminar el paciente');
}
} on DioException catch (e) {
final serverMessage = e.response?.data?['errors']?[0]?['message'] ?? e.message;
throw Exception('Error al eliminar paciente: $serverMessage');
} catch (e) {
throw Exception('Error al eliminar paciente: $e');
}
}
}