We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 864f66a commit 84a0366Copy full SHA for 84a0366
components/cart/cart_validation.js
@@ -0,0 +1,19 @@
1
+import Joi from "joi";
2
+
3
+const addProductToCartValidation = Joi.object({
4
+ cartItem: Joi.array()
5
+ .items(
6
+ Joi.object({
7
+ productId: Joi.string().hex().length(24).required(),
8
+ quantity: Joi.number().integer().min(1).default(1),
9
+ price: Joi.number().min(0).required(),
10
+ totalProductDiscount: Joi.number().min(0).required(),
11
+ })
12
+ )
13
+ .min(1),
14
+});
15
16
+const removeProductFromCart = Joi.object({
17
18
19
+export { addProductToCartValidation, removeProductFromCart };
0 commit comments