dt-common-device 13.0.13 → 13.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -603,14 +603,14 @@ let AlertService = (() => {
603
603
  const alerts = await this.queryAlerts(query);
604
604
  if (!alerts.length)
605
605
  return null;
606
- if (alerts.length > 1) {
607
- throw new Error("Multiple alerts found, please specify a more specific query");
606
+ for (const alert of alerts) {
607
+ const alertModel = await Alert_model_1.AlertModel.findById(alert._id || alert.id);
608
+ if (!alertModel)
609
+ return null;
610
+ alertModel.deactivate(updatedBy);
611
+ await alertModel.save();
608
612
  }
609
- const alert = await Alert_model_1.AlertModel.findById(alerts[0]._id || alerts[0].id);
610
- if (!alert)
611
- return null;
612
- alert.deactivate(updatedBy);
613
- return await alert.save();
613
+ return null;
614
614
  }
615
615
  /**
616
616
  * Snooze an alert with business logic
@@ -70,12 +70,13 @@ let ConnectionRepository = (() => {
70
70
  return result.rows[0];
71
71
  }
72
72
  async getConnectionsByPropertyId(propertyId) {
73
- const result = await this.pool.query("SELECT * FROM dt_connections WHERE propertyId = $1", [propertyId]);
73
+ const result = await this.pool.query(`SELECT * FROM dt_connections WHERE "propertyId" = $1`, [propertyId]);
74
74
  if (result.rows.length === 0)
75
75
  return [];
76
76
  return result.rows;
77
77
  }
78
78
  async queryConnections(query) {
79
+ console.log("queryConnections called with:", JSON.stringify(query, null, 2));
79
80
  // Filter out undefined/null values and build WHERE clause
80
81
  const conditions = [];
81
82
  const values = [];
@@ -89,12 +90,16 @@ let ConnectionRepository = (() => {
89
90
  paramIndex++;
90
91
  }
91
92
  });
93
+ console.log("Conditions:", conditions);
94
+ console.log("Values:", values);
92
95
  // Build the SQL query
93
96
  let sql = "SELECT * FROM dt_connections";
94
97
  if (conditions.length > 0) {
95
98
  sql += ` WHERE ${conditions.join(" AND ")}`;
96
99
  }
100
+ console.log("SQL Query:", sql);
97
101
  const result = await this.pool.query(sql, values);
102
+ console.log("Result:", result.rows);
98
103
  return result.rows;
99
104
  }
100
105
  async updateConnection(connectionId, data) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dt-common-device",
3
- "version": "13.0.13",
3
+ "version": "13.0.15",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [