@bee.js/node 0.0.76 → 0.0.78
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/beehive.js +4 -4
- package/package.json +1 -1
package/beehive.js
CHANGED
|
@@ -268,7 +268,7 @@ module.exports = function hive(req = {}, res = {}, model = null) {
|
|
|
268
268
|
let val = row[field];
|
|
269
269
|
|
|
270
270
|
// TODO colocar escape para sql injection
|
|
271
|
-
switch (model.schema[field]
|
|
271
|
+
switch (model.schema[field]?.type) {
|
|
272
272
|
case "char":
|
|
273
273
|
case "varchar":
|
|
274
274
|
case "text":
|
|
@@ -474,7 +474,7 @@ module.exports = function hive(req = {}, res = {}, model = null) {
|
|
|
474
474
|
},
|
|
475
475
|
|
|
476
476
|
response: function (sendData = data, action = null, status) {
|
|
477
|
-
|
|
477
|
+
const out = { data: sendData, counters, action, error };
|
|
478
478
|
|
|
479
479
|
if (res.headersSent)
|
|
480
480
|
return console.error("ERROR beejs: headers already sent");
|
|
@@ -501,11 +501,11 @@ module.exports = function hive(req = {}, res = {}, model = null) {
|
|
|
501
501
|
},
|
|
502
502
|
|
|
503
503
|
responseError: function (error, errorCode) {
|
|
504
|
-
|
|
504
|
+
const out = { error: { message: error || "an error has occurred" } };
|
|
505
505
|
|
|
506
506
|
if (global.configs.debug) out.debug = debug;
|
|
507
507
|
|
|
508
|
-
res
|
|
508
|
+
res?.status?.(errorCode || 500).send(out);
|
|
509
509
|
},
|
|
510
510
|
|
|
511
511
|
ifNull(param) {
|