Adrien de Peretti
9dcdc0041a
fix(medusa, utils): fix the way selects are consumed alongside the relations ( #4389 )
...
**What**
There is actually an issue with using the `fields` query params with the way the repositories are using our custom query strategy. This pr aims to fix this issue by reworking the strategy.
What we had to do was to rework the way the selects are built for each subquery in order to follow the aliasing convention and to be taken into consideration. Alongside these changes, the join used to always select everything, this needed to be changed so that if there are any selects provided for a join, the join should not select everything and let the query select the fields that are requested.
Another notable change is that all the repositories are now using the repository util in order to centralize the customization and to have a single place to update when this kind of issue arises. This means that the eager relations when using the query builder are not necessarily taken into account. For that reason, I have removed the `shipping_option` eager option in favor of explicitly asking for the relations like we started to do it in some places.
FIXES CORE-1413
2023-06-29 13:26:41 +00:00
Oliver Windall Juhl
a610805917
feat: Add DiscountConditions ( #1230 )
...
* feat: Add DiscountCondition entity + Join table per relation (#1146 )
* feat: Convert DiscountService to TypeScript (#1149 )
* feat: Add DiscountRepository + bulk insert and remove (#1156 )
* feat: Add `conditions` to payload in `POST /discounts` and `POST /discounts/:id` (#1170 )
* feat: Add DiscountRuleCondition entity
* fix relation
* fix join key
* Add discount rule condition repo
* add join table per relation
* Convert DiscountService to TypeScript
* feat: Add DiscountConditionRepository
* Add migration + remove use of valid_for
* revert changes to files, not done yet
* init work on create discount endpoint
* Add conditions to create discount endpoint
* Add conditions to update discount endpoint
* Add unique constraint to discount condition
* integration tests passing
* fix imports of models
* fix tests (excluding totals calculations)
* Fix commented code
* add unique constraint on discount condition
* Add generic way of generating retrieve configs
* Requested changes + ExactlyOne validator
* Remove isLocal flag from error handler
* Use postgres error constant
* remove commented code
* feat: Add `isValidForProduct` to check if Discount is valid for a given Product (#1172 )
* feat: Add `canApplyForCustomer` to check if Discount is valid for customer groups (#1212 )
* feat: Add `calculateDiscountForLineItem` (#1224 )
* feat: Adds discount condition test factory (#1228 )
* Remove use of valid_for
* Tests passing
* Remove valid_for form relations
* Add integration tests for applying discounts to cart
2022-03-24 16:47:50 +01:00
Sebastian Rindom
fbe3b98761
fix: ensure customer identify calls before order track ( #1227 )
2022-03-22 15:43:15 +01:00
Sebastian Rindom
c56660fca9
feat: new tax api ( #979 )
...
* feat: add tax calculation strategy (#885 )
* feat: add tax calculation strategy
* fix: adds strategy loader
* fix: eslint ignore
* chore: cleanup
* fix: allow plugin overwrites
* fix: allow plugin overwrites
* fix: fake region
* Update packages/medusa/src/loaders/strategies.ts
Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com >
Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com >
* feat: adds tax related db entities + tax provider (#896 )
* feat: adds tax related db entities + tax provider
* fix: add tax provider tests
* fix: add tax service unit tests
* fix: tests + migrations
* fix: add inherited tax lines
* chore: rm tax-line repo
* fix: test
* fix: pr comments
* fix: unit test
* feat: totals service to ts (#911 )
* feat: adds tax related db entities + tax provider
* fix: add tax provider tests
* fix: add tax service unit tests
* fix: tests + migrations
* feat: totals service to ts
* fix: remove totals.js
* fix: add shipping methods
* fix: add inherited tax lines
* chore: rm tax-line repo
* fix: test
* fix: tests
* fix: tests
* fix: unit test
* fix: adds TotalsServiceProps
* feat: adds integration tests for automatic tax calculation + shipping tax rates (#945 )
* feat: adds tax related db entities + tax provider
* fix: add tax provider tests
* fix: add tax service unit tests
* fix: tests + migrations
* feat: totals service to ts
* fix: remove totals.js
* fix: add shipping methods
* fix: add inherited tax lines
* chore: rm tax-line repo
* fix: test
* fix: tests
* fix: tests
* fix: unit test
* fix: integration test helpers
* fix: adds factories + tests automatic tax rates
* fix: remove verbose
* fix: adds TotalsServiceProps
* fix: add shipping tax lines
* fix: add migration for shipping taxes
* fix: integration tests for shipping taxes
* fix: integration tests for shipping taxes
* fix: jsdoc types
* Feat/manual taxes (#950 )
* feat: adds tax related db entities + tax provider
* fix: add tax provider tests
* fix: add tax service unit tests
* fix: tests + migrations
* feat: totals service to ts
* fix: remove totals.js
* fix: add shipping methods
* fix: add inherited tax lines
* chore: rm tax-line repo
* fix: test
* fix: tests
* fix: tests
* fix: unit test
* fix: integration test helpers
* fix: adds factories + tests automatic tax rates
* fix: remove verbose
* fix: adds TotalsServiceProps
* fix: add shipping tax lines
* fix: add migration for shipping taxes
* fix: integration tests for shipping taxes
* fix: integration tests for shipping taxes
* fix: add integration tests for manual taxes
* fix: cart service - cleanup jsdoc
* feat: add /carts/id/taxes to manually calculate taxes
* feat: add integration tests for order tax calculations
* fix: unit tests
* fix: merge
* fix: rm verbose
* fix: unit tests
* fix: object -> cartOrOrder
* fix: rounding
* Feat/complete order w tax lines (#951 )
* feat: adds tax related db entities + tax provider
* fix: add tax provider tests
* fix: add tax service unit tests
* fix: tests + migrations
* feat: totals service to ts
* fix: remove totals.js
* fix: add shipping methods
* fix: add inherited tax lines
* chore: rm tax-line repo
* fix: test
* fix: tests
* fix: tests
* fix: unit test
* fix: integration test helpers
* fix: adds factories + tests automatic tax rates
* fix: remove verbose
* fix: adds TotalsServiceProps
* fix: add shipping tax lines
* fix: add migration for shipping taxes
* fix: integration tests for shipping taxes
* fix: integration tests for shipping taxes
* fix: add integration tests for manual taxes
* fix: cart service - cleanup jsdoc
* feat: add /carts/id/taxes to manually calculate taxes
* feat: add integration tests for order tax calculations
* feat: adds cart completion strategy + create order w. tax lines
* fix: unit tests
* fix: merge
* fix: rm verbose
* fix: unit tests
* fix: unit tests
* fix: unit tests
* fix: ensure calculation for list orders
* fix: unit tests
* fix: integration tests
* fix: adds cart order type gaurds
* Docs/tax api (#954 )
* feat: adds tax related db entities + tax provider
* fix: add tax provider tests
* fix: add tax service unit tests
* fix: tests + migrations
* feat: totals service to ts
* fix: remove totals.js
* fix: add shipping methods
* fix: add inherited tax lines
* chore: rm tax-line repo
* fix: test
* fix: tests
* fix: tests
* fix: unit test
* fix: integration test helpers
* fix: adds factories + tests automatic tax rates
* fix: remove verbose
* fix: adds TotalsServiceProps
* fix: add shipping tax lines
* fix: add migration for shipping taxes
* fix: integration tests for shipping taxes
* fix: integration tests for shipping taxes
* fix: add integration tests for manual taxes
* fix: cart service - cleanup jsdoc
* feat: add /carts/id/taxes to manually calculate taxes
* feat: add integration tests for order tax calculations
* feat: adds cart completion strategy + create order w. tax lines
* fix: unit tests
* fix: merge
* fix: rm verbose
* fix: unit tests
* fix: unit tests
* fix: unit tests
* fix: ensure calculation for list orders
* fix: unit tests
* fix: integration tests
* docs: documents tax related methods and types
* fix: require either item_id or shipping_method_id
* feat: product type tax rate (#969 )
* feat: adds tax related db entities + tax provider
* fix: add tax provider tests
* fix: add tax service unit tests
* fix: tests + migrations
* feat: totals service to ts
* fix: remove totals.js
* fix: add shipping methods
* fix: add inherited tax lines
* chore: rm tax-line repo
* fix: test
* fix: tests
* fix: tests
* fix: unit test
* fix: integration test helpers
* fix: adds factories + tests automatic tax rates
* fix: remove verbose
* fix: adds TotalsServiceProps
* fix: add shipping tax lines
* fix: add migration for shipping taxes
* fix: integration tests for shipping taxes
* fix: integration tests for shipping taxes
* fix: add integration tests for manual taxes
* fix: cart service - cleanup jsdoc
* feat: add /carts/id/taxes to manually calculate taxes
* feat: add integration tests for order tax calculations
* feat: adds cart completion strategy + create order w. tax lines
* fix: unit tests
* fix: merge
* fix: rm verbose
* fix: unit tests
* fix: unit tests
* fix: unit tests
* fix: ensure calculation for list orders
* fix: unit tests
* fix: integration tests
* docs: documents tax related methods and types
* fix: require either item_id or shipping_method_id
* feat: adds returns tests for new tax system
* feat: adds return lines + integration tests for swaps
* feat: return integration tests
* feat: adds product type tax rates
* feat: add tax management endpoints
* fix: create single migration
* fix: adds tax rates to js client
* fix: strats
* Fix/plugin tests (#998 )
* plugin testing setup
* fix: test sendgrid plugin
* fix: test sendgrid plugin
* chore: clean
* chore: clean
* fix: clean up tests
* fix: remove dirty import
* fix: sendgrid + brightpearl
* fix: plugin integration tests
* fix: klarna
* fix: shipping method tax
* fix: remove taxrates
* fix: unit tests
* fix: integration
* fix: integration
* fix: plugins tests
* fix: ignore plugins
* fix: tests
* fix: taxes (#1017 )
* fix: taxes
* fix: taxes
* fix: faulty ref
* fix: create tax-lines with claim items
* fix: snapshot tax-liens
* fix: allows integration test teardown to force deleting tables
* fix: tests
* fix: merge
* fix: adds tax-rates to client
* fix: adds tax-rates to medusa-react
* fix: tests
* fix: tests
* fix: add product types
* fix: adds tax provider endpoint + cascaded deletes on tax rate relations
* fix: move errors to service layer
* fix: cleanup api
* fix: unit tests
* fix: error handler in base-service
* fix: Add order region to swap on createFulfillment (#1110 )
Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com >
2022-02-24 20:14:09 +01:00
Sebastian Mateos Nicolajsen
84d4d791ea
feat: allow product selection on discounts allocated to a specific item ( #395 )
2021-10-11 13:46:32 +02:00
Sebastian Rindom
55ba9bae05
fix: sends return reasons to segment on Order Refunded event
2021-07-09 11:56:34 +02:00
Oliver Windall Juhl
7343a4e841
release: next ( #239 )
...
* hotfix(medusa-plugin-brightpearl): Use order id in sales order endpoint
* feat(medusa-plugin-sendgrid): adds localization option (#238 )
* chore(deps): bump y18n from 4.0.0 to 4.0.1 in /packages/medusa-cli (#226 )
Bumps [y18n](https://github.com/yargs/y18n ) from 4.0.0 to 4.0.1.
- [Release notes](https://github.com/yargs/y18n/releases )
- [Changelog](https://github.com/yargs/y18n/blob/master/CHANGELOG.md )
- [Commits](https://github.com/yargs/y18n/commits )
Signed-off-by: dependabot[bot] <support@github.com >
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* chore(deps): bump y18n from 4.0.0 to 4.0.3 in /packages/medusa (#235 )
Bumps [y18n](https://github.com/yargs/y18n ) from 4.0.0 to 4.0.3.
- [Release notes](https://github.com/yargs/y18n/releases )
- [Changelog](https://github.com/yargs/y18n/blob/y18n-v4.0.3/CHANGELOG.md )
- [Commits](https://github.com/yargs/y18n/compare/v4.0.0...y18n-v4.0.3 )
Signed-off-by: dependabot[bot] <support@github.com >
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* chore(deps): bump y18n from 4.0.0 to 4.0.1 in /e2e/prod-project (#225 )
Bumps [y18n](https://github.com/yargs/y18n ) from 4.0.0 to 4.0.1.
- [Release notes](https://github.com/yargs/y18n/releases )
- [Changelog](https://github.com/yargs/y18n/blob/master/CHANGELOG.md )
- [Commits](https://github.com/yargs/y18n/commits )
Signed-off-by: dependabot[bot] <support@github.com >
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* chore(deps): bump y18n in /packages/medusa-core-utils (#224 )
Bumps [y18n](https://github.com/yargs/y18n ) from 4.0.0 to 4.0.1.
- [Release notes](https://github.com/yargs/y18n/releases )
- [Changelog](https://github.com/yargs/y18n/blob/master/CHANGELOG.md )
- [Commits](https://github.com/yargs/y18n/commits )
Signed-off-by: dependabot[bot] <support@github.com >
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* feat(medusa): Swaps on swaps (#229 )
Co-authored-by: Sebastian Rindom <skrindom@gmail.com >
* chore: version bumps
* chore: version bumps
* chore(release): Publish
- babel-preset-medusa-package@1.1.1
- @medusajs/medusa-cli@1.1.5
- medusa-core-utils@1.1.7
- medusa-dev-cli@0.0.6
- medusa-file-spaces@1.1.10
- medusa-fulfillment-manual@1.1.7
- medusa-fulfillment-webshipper@1.1.10
- medusa-interfaces@1.1.8
- medusa-payment-adyen@1.1.10
- medusa-payment-klarna@1.1.11
- medusa-payment-paypal@1.0.10
- medusa-payment-stripe@1.1.10
- medusa-plugin-add-ons@1.1.10
- medusa-plugin-brightpearl@1.1.13
- medusa-plugin-contentful@1.1.11
- medusa-plugin-discount-generator@1.1.1
- medusa-plugin-economic@1.1.10
- medusa-plugin-ip-lookup@1.1.1
- medusa-plugin-mailchimp@1.1.10
- medusa-plugin-permissions@1.1.10
- medusa-plugin-restock-notification@0.0.4
- medusa-plugin-segment@1.1.13
- medusa-plugin-sendgrid@1.1.11
- medusa-plugin-slack-notification@1.1.10
- medusa-plugin-twilio-sms@1.1.10
- medusa-plugin-wishlist@1.1.10
- medusa-test-utils@1.1.10
- @medusajs/medusa@1.1.20
* chore(release): Publish
- babel-preset-medusa-package@1.1.2
- @medusajs/medusa-cli@1.1.6
- medusa-core-utils@1.1.8
- medusa-dev-cli@0.0.7
- medusa-file-spaces@1.1.11
- medusa-fulfillment-manual@1.1.8
- medusa-fulfillment-webshipper@1.1.11
- medusa-interfaces@1.1.9
- medusa-payment-adyen@1.1.11
- medusa-payment-klarna@1.1.12
- medusa-payment-paypal@1.0.11
- medusa-payment-stripe@1.1.11
- medusa-plugin-add-ons@1.1.11
- medusa-plugin-brightpearl@1.1.14
- medusa-plugin-contentful@1.1.12
- medusa-plugin-discount-generator@1.1.2
- medusa-plugin-economic@1.1.11
- medusa-plugin-ip-lookup@1.1.2
- medusa-plugin-mailchimp@1.1.11
- medusa-plugin-permissions@1.1.11
- medusa-plugin-restock-notification@0.0.5
- medusa-plugin-segment@1.1.14
- medusa-plugin-sendgrid@1.1.12
- medusa-plugin-slack-notification@1.1.11
- medusa-plugin-twilio-sms@1.1.11
- medusa-plugin-wishlist@1.1.11
- medusa-test-utils@1.1.11
- @medusajs/medusa@1.1.21
Co-authored-by: Sebastian Rindom <skrindom@gmail.com >
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-04-20 16:40:49 +02:00
Sebastian Rindom
295f0f652a
fix(segment): swap tracking
2021-04-08 14:37:24 +02:00
Sebastian Rindom
0539a949fa
fix: scaffolding
2021-04-07 15:10:23 +02:00
Sebastian Rindom
73b411097e
chore: scaffolding
2021-04-07 14:14:57 +02:00
Sebastian Rindom
8eec38af71
fix: adds exchange rates api key
2021-04-02 12:34:37 +02:00
Sebastian Rindom
1b00f967de
fix: adds tests for segment
2021-03-23 11:12:11 +01:00
Sebastian Rindom
3258955b46
fix: don't divide zero decimal currencies
2021-03-22 11:00:56 +01:00
Sebastian Rindom
cfab2d408a
fix: don't divide zero decimal currencies
2021-03-22 10:31:22 +01:00
Sebastian Rindom
dd7b306333
feat(medusa): cart context ( #201 )
...
- Adds a context field to Cart
- context is automatically populated with ip + user agent
- context can be updated via POST /store/cart/:id or set when creating via POST /store/cart
2021-03-12 11:48:51 +01:00
Sebastian Rindom
98aa404306
fix: normalize currency code
2021-02-25 11:04:18 +01:00
Sebastian Rindom
d156911883
feat(segment): track shipments
2021-02-25 10:53:50 +01:00
Sebastian Rindom
0c294b7b3a
fix: add subtitle to tracks
2021-02-25 08:32:45 +01:00
Sebastian Rindom
e27cf72a8c
feat(medusa-plugin-segment): adds category and type to segment events ( #179 )
2021-02-22 08:45:01 +01:00
Sebastian Rindom
8963f38023
hotfix: remove tax from revenue calculation
2021-02-18 11:46:46 +01:00
Sebastian Rindom
0ed6b4a6a0
fix: price after discounts
2021-02-15 17:03:40 +01:00
Sebastian Rindom
6e6669dee8
fix: item reporting revenue discounted
2021-02-15 15:57:13 +01:00
Sebastian Rindom
690d339667
feat(medusa,brightpearl,segment,webshipper): claims ( #163 )
...
* chore: create tests
* chore: models
* fix: passing initial tests
* test: adds integration test
* test: clean up integration implementation
* fix: claims
* fix: brightpearl + webshipper
* tests: passing
* fix: update claim items
* fix: adds gitignore
* fix: pr comments
* fix: single migration
* fix(medusa-plugin-segment): adds item claimed event to segment
2021-02-03 09:49:12 +01:00
Oliver Windall Juhl
0e0dfea571
hotfix(medusa-plugin-segment): Unit price ( #162 )
2021-02-01 20:50:47 +01:00
Oliver Windall Juhl
4b52e9680f
hotfix(medusa-plugin-segment): Correct variant and skus ( #161 )
...
* hotfix(medusa-plugin-segment): Correct variant and skus
* --amend
2021-02-01 14:23:02 +01:00
Oliver Windall Juhl
41eeecb5a8
hotfix(medusa-plugin-segment): Fix sku ( #160 )
2021-02-01 11:56:34 +01:00
Sebastian Rindom
f1baca3cbd
Replaces MongoDB support with PostgreSQL ( #151 )
...
- All schemas have been rewritten to a relational model
- All services have been rewritten to accommodate the new data model
- Adds idempotency keys to core endpoints allowing you to retry requests with no additional side effects
- Adds staged jobs to avoid putting jobs in the queue when transactions abort
- Adds atomic transactions to all methods with access to the data layer
Co-authored-by: Oliver Windall Juhl <oliver@mrbltech.com >
2021-01-26 10:26:14 +01:00
Sebastian Rindom
8dad0b3ac7
hotfix(segment): better order tracking
2021-01-08 16:59:25 +01:00
Sebastian Rindom
a238fad7ea
Fix/enhanced tracking ( #127 )
...
* fix: adds tracking of returns and cancellations
* fix: adds tracking of returns and cancellations
2020-10-17 17:05:49 +02:00
Sebastian Rindom
6a90e94c62
fix(medusa-plugin-segment): Track additional order details
2020-09-13 11:52:55 +02:00
Sebastian Rindom
c18677d5f2
Adds integration to send sales orders to brightpearl
2020-08-03 10:23:45 +02:00
Sebastian Rindom
3710f7f80a
Adds dynamic coupon codes and segment plugin
2020-07-17 14:06:55 +02:00