1const db = require("../db");
15async function queueCommand(agentId, type, data) {
16 const result = await db.query(
17 `INSERT INTO remote_commands (agent_id, type, data, status)
18 VALUES ($1,$2,$3,'queued')
22 return result.rows[0].cmd_id;
29async function fetchPendingCommands(agentId) {
30 const result = await db.query(
31 `SELECT * FROM remote_commands
32 WHERE agent_id = $1 AND status = 'queued'`,
44async function completeCommand(cmdId, result, success) {
46 `UPDATE remote_commands SET status='success', result=$2 WHERE cmd_id=$1`,