-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(medusa): Trim discount code on insert and retrieve #2369
Conversation
🦋 Changeset detectedLatest commit: 48176d9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@@ -277,7 +275,7 @@ class DiscountService extends TransactionBaseService { | |||
const manager = this.manager_ | |||
const discountRepo = manager.getCustomRepository(this.discountRepository_) | |||
|
|||
const normalizedCode = discountCode.toUpperCase() | |||
const normalizedCode = discountCode.toUpperCase().trim() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment: This is in retrieveByCode
@@ -212,8 +212,6 @@ class DiscountService extends TransactionBaseService { | |||
const discountRule = ruleRepo.create(validatedRule) | |||
const createdDiscountRule = await ruleRepo.save(discountRule) | |||
|
|||
discount.code = discount.code!.toUpperCase() | |||
|
|||
const created: Discount = discountRepo.create( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment: Removed from create
as we are using beforeInsert
in the model
discount.code = discount.code!.toUpperCase() | ||
|
||
const created: Discount = discountRepo.create( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: why is this removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry didnt see your comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm! 💪
No description provided.