@dwtechs/antity-pgsql 0.5.1 → 0.6.1

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.
package/README.md CHANGED
@@ -121,8 +121,8 @@ const entity = new Entity("consumers", [
121
121
  ]);
122
122
 
123
123
  router.get("/", ..., entity.get);
124
- router.post("/", entity.normalize, entity.validate, ..., entity.add);
125
- router.put("/", entity.normalize, entity.validate, ..., entity.update);
124
+ router.post("/", entity.normalizeArray, entity.validateArray, ..., entity.add);
125
+ router.put("/", entity.normalizeArray, entity.validateArray, ..., entity.update);
126
126
  router.put("/", ..., entity.archive);
127
127
 
128
128
  ```
@@ -314,16 +314,14 @@ class Update {
314
314
  this._props = [];
315
315
  }
316
316
  addProp(prop) {
317
- this._props.push(quoteIfUppercase(prop));
317
+ this._props.push(prop);
318
318
  }
319
319
  query(table, rows, consumerId, consumerName) {
320
- if (consumerId !== undefined && consumerName !== undefined) {
320
+ if (consumerId !== undefined && consumerName !== undefined)
321
321
  rows = this.addConsumer(rows, consumerId, consumerName);
322
- }
323
322
  const propsToUse = [...this._props];
324
- if (consumerId !== undefined && consumerName !== undefined) {
323
+ if (consumerId !== undefined && consumerName !== undefined)
325
324
  propsToUse.push("consumerId", "consumerName");
326
- }
327
325
  const l = rows.length;
328
326
  const args = rows.map(row => row.id);
329
327
  let query = `UPDATE "${quoteIfUppercase(table)}" SET `;
@@ -331,7 +329,7 @@ class Update {
331
329
  for (const p of propsToUse) {
332
330
  if (rows[0][p] === undefined)
333
331
  continue;
334
- query += `${p} = CASE `;
332
+ query += `${quoteIfUppercase(p)} = CASE `;
335
333
  for (let j = 0; j < l; j++) {
336
334
  const row = rows[j];
337
335
  query += `WHEN id = $${j + 1} THEN $${i++} `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dwtechs/antity-pgsql",
3
- "version": "0.5.1",
3
+ "version": "0.6.1",
4
4
  "description": "Open source library to add PostgreSQL support to @dwtechs/Antity entities.",
5
5
  "keywords": [
6
6
  "entities"
@@ -38,7 +38,7 @@
38
38
  "dependencies": {
39
39
  "@dwtechs/checkard": "3.6.0",
40
40
  "@dwtechs/winstan": "0.5.0",
41
- "@dwtechs/antity": "0.13.0",
41
+ "@dwtechs/antity": "0.14.0",
42
42
  "@dwtechs/sparray": "0.2.1",
43
43
  "pg": "8.13.1"
44
44
  },