--amend
This commit is contained in:
@@ -67,7 +67,9 @@ export default async (req, res) => {
|
|||||||
usage_limit: Validator.number()
|
usage_limit: Validator.number()
|
||||||
.positive()
|
.positive()
|
||||||
.optional(),
|
.optional(),
|
||||||
usage_count: Validator.number().optional(),
|
usage_count: Validator.number()
|
||||||
|
.positive()
|
||||||
|
.optional(),
|
||||||
})
|
})
|
||||||
.required(),
|
.required(),
|
||||||
is_disabled: Validator.boolean().default(false),
|
is_disabled: Validator.boolean().default(false),
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ class DiscountService extends BaseService {
|
|||||||
allocation: Validator.string().required(),
|
allocation: Validator.string().required(),
|
||||||
valid_for: Validator.array().optional(),
|
valid_for: Validator.array().optional(),
|
||||||
usage_limit: Validator.number()
|
usage_limit: Validator.number()
|
||||||
.min(0)
|
.positive()
|
||||||
.optional(),
|
.optional(),
|
||||||
usage_count: Validator.number()
|
usage_count: Validator.number()
|
||||||
.positive()
|
.positive()
|
||||||
@@ -281,8 +281,7 @@ class DiscountService extends BaseService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (rule) {
|
if (rule) {
|
||||||
const updated = this.validateDiscountRule_(rule)
|
discount.rule = this.validateDiscountRule_(rule)
|
||||||
discount.rule = { ...discount.rule, ...updated }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const [key, value] of Object.entries(rest)) {
|
for (const [key, value] of Object.entries(rest)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user