@autofleet/sheilta 1.3.2-1 → 1.3.2-2
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/lib/interface.d.ts
CHANGED
package/lib/validations/index.js
CHANGED
|
@@ -21,12 +21,12 @@ const validateSingleOrder = (currentOrder, rawAttributes, associationModels, opt
|
|
|
21
21
|
currentOrder.split(utils_1.ORDER_PREFIX)[1] : currentOrder;
|
|
22
22
|
const isOrderAssociation = utils_1.isAttributeByAssociation(orderStringWithoutDesc, associationModels);
|
|
23
23
|
let formattedOrderString = utils_1.extractAttributeNameFromOrder(currentOrder, associationModels);
|
|
24
|
-
const isLiteralAttribute = (_a = options === null || options === void 0 ? void 0 : options.
|
|
24
|
+
const isLiteralAttribute = (_a = options === null || options === void 0 ? void 0 : options.literalAttributes) === null || _a === void 0 ? void 0 : _a.includes(orderStringWithoutDesc);
|
|
25
25
|
if (!isOrderAssociation && formattedOrderString.includes(utils_1.ASSOCIATION_PREFIX)) {
|
|
26
26
|
[formattedOrderString] = formattedOrderString.split(utils_1.ASSOCIATION_PREFIX);
|
|
27
27
|
}
|
|
28
28
|
if (!(rawAttributes.includes(formattedOrderString) || isOrderAssociation || isLiteralAttribute)) {
|
|
29
|
-
utils_1.throwBadRequestError(`${currentOrder} is invalid`);
|
|
29
|
+
utils_1.throwBadRequestError(`${currentOrder} is invalid isLiteralAttribute: ${isLiteralAttribute}`);
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
32
|
const validateSingleAttribute = (currentAttribute, rawAttributes) => {
|
|
@@ -187,7 +187,7 @@ describe('validations test', () => {
|
|
|
187
187
|
startTime: '', endTime: '', currencySymbol: '', currencyCode: '', startStationId: '', status: '',
|
|
188
188
|
},
|
|
189
189
|
}, {
|
|
190
|
-
|
|
190
|
+
literalAttributes: [literalAttribute],
|
|
191
191
|
});
|
|
192
192
|
expect(payload).toBe(true);
|
|
193
193
|
});
|
|
@@ -197,7 +197,7 @@ describe('validations test', () => {
|
|
|
197
197
|
rawAttributes: {
|
|
198
198
|
startTime: '', endTime: '', currencySymbol: '', currencyCode: '', startStationId: '', status: '',
|
|
199
199
|
},
|
|
200
|
-
}, {
|
|
200
|
+
}, { literalAttributes: ['not'] });
|
|
201
201
|
}
|
|
202
202
|
catch (error) {
|
|
203
203
|
expect(error.statusCode).toBe(400);
|