@dwtechs/antity-pgsql 0.17.7 → 0.18.0
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/dist/antity-pgsql.js +7 -7
- package/package.json +1 -1
package/dist/antity-pgsql.js
CHANGED
|
@@ -69,7 +69,7 @@ function execute(query, args, clt) {
|
|
|
69
69
|
return res;
|
|
70
70
|
})
|
|
71
71
|
.catch((err) => {
|
|
72
|
-
err.
|
|
72
|
+
err.message = `Postgre error: ${err.message}`;
|
|
73
73
|
throw err;
|
|
74
74
|
});
|
|
75
75
|
}
|
|
@@ -278,7 +278,7 @@ class Select {
|
|
|
278
278
|
return execute(query, args, client)
|
|
279
279
|
.then((r) => {
|
|
280
280
|
if (!r.rowCount)
|
|
281
|
-
throw { status: 404,
|
|
281
|
+
throw { status: 404, message: "Resource not found" };
|
|
282
282
|
const f = r.rows[0];
|
|
283
283
|
if (f.total) {
|
|
284
284
|
r.total = Number(f.total);
|
|
@@ -811,10 +811,10 @@ class SQLEntity extends Entity {
|
|
|
811
811
|
const cId = l.consumer?.id;
|
|
812
812
|
const cName = l.consumer?.nickname;
|
|
813
813
|
if (!conflictTarget) {
|
|
814
|
-
return next({ status: 400,
|
|
814
|
+
return next({ status: 400, message: "Missing conflictTarget for upsert operation" });
|
|
815
815
|
}
|
|
816
816
|
if (!rows || !Array.isArray(rows) || rows.length === 0) {
|
|
817
|
-
return next({ status: 400,
|
|
817
|
+
return next({ status: 400, message: "Missing or empty rows array for upsert operation" });
|
|
818
818
|
}
|
|
819
819
|
log.debug(() => `${LOGS_PREFIX}upsert(rows=${rows.length}, conflictTarget=${conflictTarget}, consumerId=${cId})`);
|
|
820
820
|
const rtn = this.ups.rtn("id");
|
|
@@ -881,7 +881,7 @@ class SQLEntity extends Entity {
|
|
|
881
881
|
const id = req.params.id;
|
|
882
882
|
const dbClient = res.locals.dbClient || null;
|
|
883
883
|
if (!id) {
|
|
884
|
-
next({ status: 400,
|
|
884
|
+
next({ status: 400, message: "Missing id" });
|
|
885
885
|
return;
|
|
886
886
|
}
|
|
887
887
|
log.debug(() => `${LOGS_PREFIX}getHistory(schema=${this._schema}, table=${this._table}, id=${id})`);
|
|
@@ -897,7 +897,7 @@ class SQLEntity extends Entity {
|
|
|
897
897
|
.then((r) => {
|
|
898
898
|
const { rowCount, rows } = r;
|
|
899
899
|
if (!rowCount) {
|
|
900
|
-
return next({ status: 404,
|
|
900
|
+
return next({ status: 404, message: "History not found" });
|
|
901
901
|
}
|
|
902
902
|
res.locals.history = rows;
|
|
903
903
|
res.locals.total = rowCount;
|
|
@@ -912,7 +912,7 @@ class SQLEntity extends Entity {
|
|
|
912
912
|
const cId = l.consumer?.id;
|
|
913
913
|
const cName = l.consumer?.nickname;
|
|
914
914
|
if (!rows || !Array.isArray(rows)) {
|
|
915
|
-
return next({ status: 400,
|
|
915
|
+
return next({ status: 400, message: "Missing or invalid rows array for sync operation" });
|
|
916
916
|
}
|
|
917
917
|
log.debug(() => `${LOGS_PREFIX}sync(rows=${rows.length}, idField=${idField}, consumerId=${cId})`);
|
|
918
918
|
const cleanedFilters = cleanFilters(req.body.filters, this.properties) || null;
|