Skip to content
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

Merged
merged 4 commits into from
Oct 7, 2022

Conversation

olivermrbl
Copy link
Contributor

No description provided.

@olivermrbl olivermrbl requested a review from pKorsholm October 6, 2022 11:28
@olivermrbl olivermrbl requested a review from a team as a code owner October 6, 2022 11:28
@changeset-bot
Copy link

changeset-bot bot commented Oct 6, 2022

🦋 Changeset detected

Latest commit: 48176d9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@medusajs/medusa Patch

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()
Copy link
Contributor Author

@olivermrbl olivermrbl Oct 6, 2022

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(
Copy link
Contributor Author

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(
Copy link
Collaborator

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?

Copy link
Collaborator

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

Copy link
Collaborator

@srindom srindom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Contributor

@pKorsholm pKorsholm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! 💪

@olivermrbl olivermrbl merged commit d2b272f into develop Oct 7, 2022
@olivermrbl olivermrbl deleted the feat/trim-dicount-code branch October 7, 2022 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants