File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change
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
+ } ;
You can’t perform that action at this time.
0 commit comments