updates commands
This commit is contained in:
@@ -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})
|
||||
|
||||
Reference in New Issue
Block a user