data-validation-proximity 1.3.4 → 1.3.6
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/index.js +6 -5
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -344,6 +344,7 @@ exports.itemSchemaValidation = createValidationMiddleware(itemSchema);
|
|
|
344
344
|
|
|
345
345
|
const createCategorySchema = joi.object({
|
|
346
346
|
name: joi.string().required(),
|
|
347
|
+
confirmed: joi.bool(),
|
|
347
348
|
});
|
|
348
349
|
|
|
349
350
|
exports.createCategorySchemaValidation = createValidationMiddleware(createCategorySchema);
|
|
@@ -465,11 +466,11 @@ const updateProductSchema = joi.object({
|
|
|
465
466
|
sellerId: joi.string().required(),
|
|
466
467
|
price: joi.number().min(1).max(1000000),
|
|
467
468
|
description: joi.string().min(3).max(800),
|
|
468
|
-
tags: joi.array().items(joi.string().min(3)),
|
|
469
|
+
tags: joi.alternatives().try(joi.array().items(joi.string().min(3)), joi.string()),
|
|
469
470
|
discount: joi.number().min(0),
|
|
470
471
|
image: joi.string().min(3),
|
|
471
472
|
images: joi.array().items(joi.string().min(3)),
|
|
472
|
-
existingImages: joi.array().items(joi.string().min(3)),
|
|
473
|
+
existingImages: joi.alternatives().try(joi.array().items(joi.string().min(3)), joi.string()),
|
|
473
474
|
storeId: joi.string().required(),
|
|
474
475
|
categoryId: joi.string(),
|
|
475
476
|
storeCategoryId: joi.string(),
|
|
@@ -483,7 +484,7 @@ const updateProductSchema = joi.object({
|
|
|
483
484
|
});
|
|
484
485
|
|
|
485
486
|
exports.updateProductSchemaValidation = createValidationMiddleware(updateProductSchema, (req) => {
|
|
486
|
-
parseJsonFields(req, ['variants', 'policy']);
|
|
487
|
+
parseJsonFields(req, ['variants', 'policy', 'tags', 'existingImages']);
|
|
487
488
|
console.log('req.body.variants:', req.body.variants);
|
|
488
489
|
});
|
|
489
490
|
|
|
@@ -492,7 +493,7 @@ const createProductSchema = joi.object({
|
|
|
492
493
|
price: joi.number().min(1).required(),
|
|
493
494
|
description: joi.string().min(3).max(800),
|
|
494
495
|
images: joi.array().items(joi.string().min(3)),
|
|
495
|
-
tags: joi.array().items(joi.string().min(2)),
|
|
496
|
+
tags: joi.alternatives().try(joi.array().items(joi.string().min(2)), joi.string()),
|
|
496
497
|
sellerId: joi.string(),
|
|
497
498
|
discount: joi.number().min(0),
|
|
498
499
|
discountType: joi.string(),
|
|
@@ -510,7 +511,7 @@ const createProductSchema = joi.object({
|
|
|
510
511
|
|
|
511
512
|
exports.createProductSchemaValidation = createValidationMiddleware(createProductSchema, (req) => {
|
|
512
513
|
console.log('Validating product creation:', req.body);
|
|
513
|
-
parseJsonFields(req, ['variants', 'policy']);
|
|
514
|
+
parseJsonFields(req, ['variants', 'policy', 'tags']);
|
|
514
515
|
normalizeFileArrays(req);
|
|
515
516
|
});
|
|
516
517
|
|