mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
docs
This commit is contained in:
@@ -29,31 +29,4 @@ Manage the **online history records** of devices. Currently, the API supports de
|
||||
```bash
|
||||
curl -X DELETE "http://<server_ip>:<GRAPHQL_PORT>/history" \
|
||||
-H "Authorization: Bearer <API_TOKEN>"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Implementation Details
|
||||
|
||||
The endpoint calls the helper function `delete_online_history()`:
|
||||
|
||||
```python
|
||||
def delete_online_history():
|
||||
"""Delete all online history activity"""
|
||||
|
||||
conn = get_temp_db_connection()
|
||||
cur = conn.cursor()
|
||||
|
||||
# Remove all entries from Online_History table
|
||||
cur.execute("DELETE FROM Online_History")
|
||||
|
||||
conn.commit()
|
||||
conn.close()
|
||||
|
||||
return jsonify({"success": True, "message": "Deleted online history"})
|
||||
```
|
||||
|
||||
* Opens a temporary database connection for the request.
|
||||
* Executes a **full table delete** (`DELETE FROM Online_History`).
|
||||
* Commits the transaction and closes the connection.
|
||||
* Returns a JSON confirmation message.
|
||||
```
|
||||
Reference in New Issue
Block a user