Skip to content

Commit faac0c2

Browse files
committed
components: coupon[coupon_validation]
1 parent 691ace4 commit faac0c2

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import Joi from "joi";
2+
3+
const createCouponValidation = Joi.object({
4+
code: Joi.string().required().trim(),
5+
expires: Joi.date().required(),
6+
discount: Joi.number().required().min(0),
7+
});
8+
9+
const getSpecificCouponValidation = Joi.object({
10+
id: Joi.string().hex().length(24).required(),
11+
});
12+
13+
const updateCouponValidation = Joi.object({
14+
id: Joi.string().hex().length(24).required(),
15+
code: Joi.string().trim(),
16+
expires: Joi.date(),
17+
discount: Joi.number().min(0),
18+
});
19+
20+
const deleteCouponValidation = Joi.object({
21+
id: Joi.string().hex().length(24).required(),
22+
});
23+
24+
export {
25+
createCouponValidation,
26+
getSpecificCouponValidation,
27+
updateCouponValidation,
28+
deleteCouponValidation,
29+
};

0 commit comments

Comments
 (0)