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