@autofleet/sheilta 1.0.4-aaron-test → 1.0.5-aaron-test

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.
@@ -70,29 +70,26 @@ const validateIncludePayload = (include, associations) => {
70
70
  const associationsKeys = Object.keys(associations);
71
71
  include.forEach((i) => {
72
72
  var _a;
73
- try {
74
- validateQueryAttribute(i.model, associationsKeys);
75
- const target = (_a = associations[i.model]) === null || _a === void 0 ? void 0 : _a.target;
76
- if (!target) {
77
- utils_1.throwBadRequestError('model not found in associations');
78
- }
79
- const { rawAttributes } = target;
80
- if (include.where) {
81
- validateQueryPayload(i.where, rawAttributes);
82
- }
83
- if (include.order) {
84
- validateOrderAttributes(i.order, rawAttributes);
85
- }
86
- if (include.attributes) {
87
- validateAttributes(i.attributes, rawAttributes);
88
- }
89
- if (!lodash_1.default.isNil(include.required) && !lodash_1.default.isBoolean(include.required)) {
90
- utils_1.throwBadRequestError('include.required must be a boolean');
91
- }
73
+ console.log('i', i);
74
+ validateQueryAttribute(i.model, associationsKeys);
75
+ const target = (_a = associations[i.model]) === null || _a === void 0 ? void 0 : _a.target;
76
+ if (!target) {
77
+ utils_1.throwBadRequestError('model not found in associations');
78
+ }
79
+ const { rawAttributes } = target;
80
+ if (include.where) {
81
+ validateQueryPayload(i.where, rawAttributes);
82
+ }
83
+ if (include.order) {
84
+ validateOrderAttributes(i.order, rawAttributes);
85
+ }
86
+ if (include.attributes) {
87
+ validateAttributes(i.attributes, rawAttributes);
92
88
  }
93
- catch (e) {
94
- utils_1.throwBadRequestError('there was a problem with the include payload');
89
+ if (!lodash_1.default.isNil(include.required) && !lodash_1.default.isBoolean(include.required)) {
90
+ utils_1.throwBadRequestError('include.required must be a boolean');
95
91
  }
92
+ console.log('loopend');
96
93
  });
97
94
  };
98
95
  exports.validatePayload = ({ query = {}, order = [], attributes = [], include = [], page = utils_1.PAGE_DEFAULT, perPage = utils_1.PER_PAGE_DEFAULT, }, model) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autofleet/sheilta",
3
- "version": "1.0.4-aaron-test",
3
+ "version": "1.0.5-aaron-test",
4
4
  "description": "manage cache",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",