av6-core 1.3.9 → 1.3.10
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/index.js +5 -1
- package/dist/index.mjs +5 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1578,7 +1578,11 @@ var commonService = (serviceDeps) => {
|
|
|
1578
1578
|
}
|
|
1579
1579
|
const ctx = { userId: currentUser ?? void 0, vars: {} };
|
|
1580
1580
|
const schema = buildJoiSchemaForOp(cfg, "create", { decimalPrecision: store?.defaultPrecision ?? 2 });
|
|
1581
|
-
|
|
1581
|
+
let { value: validated, error } = schema.validate(createParams.body);
|
|
1582
|
+
if (error) {
|
|
1583
|
+
const messages = error.details.map((d) => d.message.replace(/['"]/g, "")).join(", ");
|
|
1584
|
+
throw new ErrorHandler(400, messages, error.details);
|
|
1585
|
+
}
|
|
1582
1586
|
if (validationMapping && validationMapping[shortCodeData.shortCode] && validationMapping[shortCodeData.shortCode].create) {
|
|
1583
1587
|
await validationMapping[shortCodeData.shortCode].create?.(validated);
|
|
1584
1588
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1528,7 +1528,11 @@ var commonService = (serviceDeps) => {
|
|
|
1528
1528
|
}
|
|
1529
1529
|
const ctx = { userId: currentUser ?? void 0, vars: {} };
|
|
1530
1530
|
const schema = buildJoiSchemaForOp(cfg, "create", { decimalPrecision: store?.defaultPrecision ?? 2 });
|
|
1531
|
-
|
|
1531
|
+
let { value: validated, error } = schema.validate(createParams.body);
|
|
1532
|
+
if (error) {
|
|
1533
|
+
const messages = error.details.map((d) => d.message.replace(/['"]/g, "")).join(", ");
|
|
1534
|
+
throw new ErrorHandler(400, messages, error.details);
|
|
1535
|
+
}
|
|
1532
1536
|
if (validationMapping && validationMapping[shortCodeData.shortCode] && validationMapping[shortCodeData.shortCode].create) {
|
|
1533
1537
|
await validationMapping[shortCodeData.shortCode].create?.(validated);
|
|
1534
1538
|
}
|