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

Fix ability to move merch item under another collection #432

Closed
wants to merge 3 commits into from

Conversation

dowhep
Copy link
Contributor

@dowhep dowhep commented Apr 9, 2024

Info

Closes #433.

Description

What changes did you make? List all distinct problems that this PR addresses. Explain any relevant
motivation or context.

enable collection property to be editable through PATCH /item/:uuid

Changes

edited the logic for merch store service over itemedit

Type of Change

  • Patch (non-breaking change/bugfix)
  • Minor (non-breaking change which adds functionality)
  • Major (fix or feature that would cause existing functionality to not work as
    expected)
  • Documentation (A change to a README/description)
  • Continuous Integration/DevOps Change (Related to deployment steps, continuous integration
    workflows, linting, etc.)
  • Other: (Fill In)

If you've selected Patch, Minor, or Major as your change type, make sure to bump the version before merging in package.json!

Testing

I have tested that my changes fully resolve the linked issue ...

  • locally.
  • on the testing API/testing database.
  • with appropriate Postman routes. Screenshots are included below.

Checklist

  • I have performed a self-review of my own code.
  • I have followed the style guidelines of this project.
  • I have appropriately edited the API version in the package.json file.
  • My changes produce no new warnings.

Screenshots

Please include a screenshot of your Postman testing passing successfully.

Copy link

github-actions bot commented Apr 9, 2024

Thanks for contributing!
If you've made changes to the API's functionality, please make sure to bump the package
version—see this guide to semantic versioning for details—and
document those changes as appropriate.

@dowhep dowhep marked this pull request as ready for review April 9, 2024 06:13
Copy link
Member

@nik-dange nik-dange left a comment

Choose a reason for hiding this comment

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

one quick question

@@ -346,7 +346,9 @@ export default class MerchStoreService {
.merchStoreCollection(txn)
.findByUuid(updatedCollection);
if (!collection) throw new NotFoundError('Merch collection not found');
updatedItem.collection = collection;
Copy link
Member

@nik-dange nik-dange Apr 26, 2024

Choose a reason for hiding this comment

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

If you look at line 341, there's a call to MerchandiseItemModel.merge(). However, line 352 (merchItemRepository.upsertMerchItem()) calls MerchandiseItemModel.merge() internally. What's the reason for this difference? Is there a need to call the model's merge method directly prior to checking if there's an updated collection?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we merge at line 341 so that we can immediately test whether the merged item is a valid item or not on line 342, although upsertMerchItem does call merge internally, it does not do the checking by itself and requires external check for validations. In addition, merge is a fast operation so we can kinda use it freely.

@dowhep
Copy link
Contributor Author

dowhep commented May 8, 2024

closing this bc @nik-dange addressed it in his pr

@dowhep dowhep closed this May 8, 2024
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.

2 participants