updates commands

This commit is contained in:
2026-04-20 00:14:48 +03:00
parent 10cca7135a
commit c801b1800c
3 changed files with 12 additions and 12 deletions

View File

@@ -113,15 +113,14 @@ def create_command():
# ------------------------------------------------------------------
# DELETE /dashboard/commands/<id>
# Cancel a pending command from the dashboard.
# Fully delete a command from the dashboard history.
# ------------------------------------------------------------------
@dashboard.route('/dashboard/commands/<int:cmd_id>', methods=['DELETE'])
def cancel_command(cmd_id):
conn = get_db()
conn.execute('''
UPDATE commands SET status = 'cancelled', updated_at = ?
WHERE id = ? AND status = 'pending'
''', (datetime.utcnow().isoformat(), cmd_id))
DELETE FROM commands WHERE id = ?
''', (cmd_id,))
conn.commit()
conn.close()
return jsonify({'ok': True})