Commit Graph

413 Commits

Author SHA1 Message Date
Riqwan Thamir
0a6aa0e624 feat(medusa): categories can be ranked based on position (#3341)
* chore: categories can be ranked based on position

* chore: fix tests

* chore: sort categories by order

* chore: fix bug where mpath relationship is messed up

* chore: enable linting - lint changes

* Update packages/medusa/src/repositories/product-category.ts

Co-authored-by: Frane Polić <16856471+fPolic@users.noreply.github.com>

* chore: fixed specs

* chore: cleanup repository to new typeorm interfaces + cleanup

* chore: revert repository changes due to incorrect sql

* chore: addressed pr reviews

---------

Co-authored-by: Frane Polić <16856471+fPolic@users.noreply.github.com>
Co-authored-by: adrien2p <adrien.deperetti@gmail.com>
2023-03-06 15:49:16 +01:00
olivermrbl
ad99a8bd24 chore: Fix merge conflicts with master 2023-03-03 12:01:35 +01:00
Kasper Fabricius Kristensen
40de54b010 feat(admin,admin-ui,medusa): Add Medusa Admin plugin (#3334) 2023-03-03 10:09:16 +01:00
Riqwan Thamir
c432481319 fix(medusa): Creating Product with Sales Channels disabled (#3357) 2023-03-02 11:59:10 +01:00
Adrien de Peretti
cbbf3ca054 fix(medusa): Clean response data usage for admin and store fields/expand (#3323)
* fix(medusa): Clean response data usage for admin and store fields/expand

* cleanup

* Create mighty-ads-fold.md

* fix integration

* fix integration

* refactor transform query and cleanup

* fix missing re naming

* Update packages/medusa/src/api/middlewares/transform-query.ts

---------

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
2023-02-28 09:48:08 +01:00
Riqwan Thamir
6323868f65 feat(medusa) allow querying category descendants with a param in list endpoint (#3321)
What:

Allowing the list endpoint to return a full tree when requested. 

Why:

When scoped with parent_category_id=null and include_descendant_tree=true, the query cost is fairly low. This allows for fast querying and prevent FE from building out the entire tree from a flat list repeatedly. By default, it is set to false, so this should be an intentional change knowing the costs of doing it for the entire result set. 

How:

When include_descendants_tree is included in the request parameter or the service parameter, we do a loop on results of product categories and do a call to fetch the descendants of that product category. 

RESOLVES CORE-1128
2023-02-24 08:46:52 +00:00
olivermrbl
e1b92e9b04 fix: Merge conflicts with master 2023-02-22 17:38:49 +01:00
Riqwan Thamir
68496ffe60 fix(medusa): fixes bug for mpath incorrectly updated for nested categories (#3311)
* chore: fix issue with mpath being incorrectly set

* chore: address review changes
2023-02-22 15:43:58 +01:00
Adrien de Peretti
d11ab924b8 feat(medusa): Configurable returnable_items on order decorate totals (#3276) 2023-02-21 14:48:49 +01:00
Frane Polić
6c04624727 chore(medusa): remove PublishableAPIKeys feature flag (#3087) 2023-02-20 21:16:08 +01:00
Adrien de Peretti
46547f29c7 chore(medusa): Improve store list products (#3252)
* chore(medusa): Improve list products by 46.5 percents

* fix handler

* todo's

* Create tricky-terms-wash.md

---------

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
2023-02-20 12:45:05 +01:00
Oliver Windall Juhl
f88af0c28d fix(medusa): Received quantity on return lines (#3267) 2023-02-17 10:13:50 +00:00
Riqwan Thamir
121b42acfe chore(medusa): Typeorm upgrade to 0.3.11 (#3041) 2023-02-15 16:25:30 +01:00
Oliver Windall Juhl
968eb8fc6b fix(medusa): Refund amount on returns in claim flow (#3237) 2023-02-14 12:47:06 +01:00
Adrien de Peretti
5e0273a370 chore(medusa): New totals calc. in Swap creation (#3191)
* feat(medusa): Cleanup swap creation flow

* revert test and package

* fix unit tests

* fix swap seeder that does not include the tax lines on the return line item

---------

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
2023-02-14 10:52:45 +01:00
Carlos R. L. Rodrigues
80452332d8 fix(medusa): Default sales channel on product create (#3249)
What:
Assign the default sales channel if none is provided while creating a new product.


FIXES: CORE-1114

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
2023-02-14 08:46:14 +00:00
Adrien de Peretti
4cb44a3a2e fix(medusa): Discount allocation precision issues (#3244) 2023-02-13 17:22:18 +01:00
Oliver Windall Juhl
472f96d7fb fix(medusa): Missing refund amount when creating claim (#3224) 2023-02-10 09:26:54 +01:00
Adrien de Peretti
eee9283818 feat(medusa): Allow empty fields/expand (#3220) 2023-02-09 18:05:56 +01:00
Frane Polić
61b0b2f3aa fix(medusa): Pass query transformer config in storefront controllers (#3219) 2023-02-09 17:52:04 +01:00
Adrien de Peretti
bfa33f444c fix(medusa): Applying Discounts (with Conditions) on DraftOrders and Carts (#3197) 2023-02-08 19:01:23 +01:00
Kasper Fabricius Kristensen
b9bda3bf4e fix(medusa): Allow method.data to be passed when creating/updating ShippingMethods in ClaimService (#3205)
**What**
- Allows passing data on shipping methods during claim creation and updates. Defaults to an empty object.

**Testing** 
- Updates a test so it also passes along shipping method data.
2023-02-08 12:37:35 +00:00
Kasper Fabricius Kristensen
86c87c7b10 fix(medusa): Deleting product prices (#3152) 2023-02-08 13:13:34 +01:00
Frane Polić
5b63533c77 feat(medusa): Preserve custom adjustments when refreshing adjustments (#3085) 2023-02-06 19:22:05 +01:00
Kasper Fabricius Kristensen
d0adaf57ed fix(medusa): Shipping profile CRUD (#3154)
**What**
- Fixes wrong payload class for `POST /admin/shipping-profiles`
- Fixes wrong payload class for `POST /admin/shipping-profiles/:id`
- Fixes an issue where updating a shipping profile with products and/or shipping options would fail.
- Fixes an issue where passing `profile_id` to `ShippingOptionService.update()` would not update the shipping profile of the option.

**Testing** 
- Adds new `simpleshippingProfileFactory`
- Adds new integration test suite for shipping profiles operations.

Resolves CORE-1065
2023-02-06 16:57:12 +00:00
Frane Polić
4d6e63d68f feat(medusa): Decorate OrderEdit LineItems with totals (#3108) 2023-02-06 17:32:26 +01:00
Frane Polić
e22a383f47 fix(medusa): fields params usage in the storefront endpoints (#2980) 2023-02-06 16:18:23 +01:00
Riqwan Thamir
be0d36432a feat(medusa-js): added resources for product categories (#3157)
What:

JS client resources for product categories

Why:

To manage product categories and managing product-category relationship

How:

- adds a JS client resource for product categories.

RESOLVES CORE-1066
RESOLVES CORE-969
RESOLVES CORE-1061
2023-02-01 17:52:39 +00:00
Riqwan Thamir
4105405f28 feat(medusa): Filter products by category params in store/admin (#3155)
What:

Products can be filtered through the API by category parameters

Why:

To filter products by category

How:

- adds 2 params in admin/store route
- updates repository to accept 2 new parameters

RESOLVES CORE-1032
RESOLVES CORE-1033
2023-02-01 17:25:07 +00:00
Oliver Windall Juhl
b242e22326 fix(medusa): Upsert addresses on Orders (#3153) 2023-02-01 13:57:24 +01:00
Riqwan Thamir
5ec6d438fb feat(medusa): batch remove products from a category (#3141)
* chore: added batch endpoint to remove products from categories

* chore: remove consoles

* Apply suggestions from code review

Co-authored-by: Patrick <116003638+patrick-medusajs@users.noreply.github.com>

* chore: added oas changes

---------

Co-authored-by: Patrick <116003638+patrick-medusajs@users.noreply.github.com>
2023-01-31 10:23:03 +01:00
Adrien de Peretti
e581d3bd90 chore(integration-tests): Flaky tests (#3126) 2023-01-27 17:45:54 +01:00
Riqwan Thamir
4f0d8992a0 feat(medusa): Products can be added to categories in batch request (#3123)
* wip

* chore: fix issues with join table

* chore: fix issues

* chore: fix ordering issue on random failing test

* chore: revert table name

* chore: added oas for category

* chore: update categories for a product

* chore: add remove category test

* chore: added changeset

* chore: address review comments

* chore: Products can be added to categories in batch request

* chore: address review comments + add unit specs

* chore: make template optional
2023-01-27 15:58:58 +01:00
Riqwan Thamir
ee42b60a20 feat(medusa): add or remove categories from products (#3114)
* wip

* chore: fix issues with join table

* chore: fix issues

* chore: fix ordering issue on random failing test

* chore: revert table name

* chore: added oas for category

* chore: update categories for a product

* chore: add remove category test

* chore: added changeset

* chore: address review comments

* Apply suggestions from code review

Co-authored-by: Philip Korsholm <88927411+pKorsholm@users.noreply.github.com>

Co-authored-by: Philip Korsholm <88927411+pKorsholm@users.noreply.github.com>
2023-01-27 15:25:46 +01:00
Kasper Fabricius Kristensen
fcba705701 fix(medusa): Allow deleting metadata fields (#3055) 2023-01-19 11:34:13 +01:00
Kasper Fabricius Kristensen
150696de99 feat(medusa, medusa-js, medusa-react): Add endpoint to retrieve product tags from the storefront (#3051) 2023-01-18 10:47:15 +01:00
Riqwan Thamir
7d4b8b9cc5 feat(medusa): List (service + controller) product categories #3004 (#3023)
**What:**

Introduces a store endpoint to retrieve a list of product categories

**Why:**

This is part of a greater goal of allowing products to be added to multiple categories.

**How:**

- Creates an endpoint in store routes

RESOLVES CORE-968
2023-01-16 19:20:42 +00:00
Oliver Windall Juhl
9e3beaf531 chore(feature-flags): Remove OrderEditing feature flag (#3006) 2023-01-13 11:10:09 +00:00
Riqwan Thamir
b2839e2e4d feat(medusa): Retrieve (service + controller) a product category (#3004)
What:

Introduces a store endpoint to retrieve a product category

Why:

This is part of a greater goal of allowing products to be added to multiple categories.

How:

- Creates an endpoint in store routes

RESOLVES CORE-967
2023-01-12 16:19:06 +00:00
Riqwan Thamir
aab163babb feat(medusa): Nested Categories Admin Update Endpoint (#2986)
What:

Introduces an admin endpoint that allows a user to update a product category

Why:

This is part of a greater goal of allowing products to be added to multiple categories.

How:

- Creates a route on the admin scope to update category
- Creates a method in product category services to update a category

RESOLVES CORE-956
2023-01-11 16:21:53 +00:00
Riqwan Thamir
8ed4eab73a feat(medusa): added admin create endpoint for nested categories (#2985)
What:

Introduces an admin endpoint that allows a user to create a product category

Why:

This is part of a greater goal of allowing products to be added to multiple categories.

How:

- Creates a route on the admin scope to create category
- Creates a method in product category services to create a category

RESOLVES CORE-958
2023-01-11 13:29:02 +00:00
Oliver Windall Juhl
3308766389 chore(feature-flags): Sales Channels enabled by default (#2966) 2023-01-10 16:45:23 +00:00
Riqwan Thamir
71fa60892c feat(medusa): Nested Categories Admin Delete Endpoint (#2975)
**What:**

Introduces an admin endpoint that allows a user to delete a product category, given an ID.

Why:

This is part of a greater goal of allowing products to be added to multiple categories.

How:

- Creates a route on the admin scope to delete category
- Creates a method in product category services to delete a category

RESOLVES CORE-957
2023-01-10 14:28:46 +00:00
Riqwan Thamir
f3ced106ad feat(medusa): Nested Categories Admin List Endpoint (#2973)
* chore: added get route for admin categories API

* chore: add tree method to mock repository

* chore: added changeset to the PR

* chore: rename id to productCategoryId in service

* chore: switch cli option to string

* chore: lint fixes, tests for parent category

* chore: move Nested Categories behind feature flag

* chore: use transformQuery hook in api

* chore: add feature flag in migrations

* chore: remove migration FF, fix FF name

* chore: add free text search + count repo function

* chore: added list endpoint for admin

* chore: added changeset for feature

* chore: address pr review comments

* chore: change oas comment

* chore: add nullable parent category filter + test
2023-01-10 12:52:31 +01:00
Adrien de Peretti
1817b810fc fix(medusa): Cancel order missing refunds relation (#2976)
**What**

The order cancelation does not include the refunds relation. It means that the check of the length of the refund is never true and therefore no errors are thrown if the order contains the refunds.

**How**

Add the refunds relation and tests

FIXES CORE-976

Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
2023-01-10 09:38:59 +00:00
Riqwan Thamir
47d075351f feat(medusa): Get route for admin product categories API (#2961) 2023-01-10 10:08:16 +01:00
Philip Korsholm
16716f5a4f feat(medusa): Create fulfillment with location (#2931)
* remove duplicate key from oas

* changeset

* initial suggestion for adding locations to fulfillments

* update migration

* re-add functionality for removing entire reservations

* fix tests

* add location when adjusting reserved inventory of a line_item

* add changest

* handle multiple reservations for a product in the same channel

* confirm inventory in stock location previous to creating the fulfillment

* fix tests after updating create-fulfillment to confirm inventory prior to creating fulfillment

* remove bugged code

* initial validation

* initial changes for review

* chekcpoint

* update validate inventory at location

* redo some unwanted changes

* typing

* update snapshots

* redo change for eslintrc

* add eslint disable

* re-order methods in interface

* assert no_notification

* iterate one time less

* add test for validation of correct inventory adjustments in case of no inventory service installation

* ensure correct adjustments for order cancellations

* remove comment

* fix tests

* fix but with coalescing

* remove location id from confirm inventory

* don't throw when adjusting reservations for a line item without reservations

* move reservation adjustments to the api

* add multiplication for updating a reservation quantity

* move inventory adjustments from the service layer to the api

* delete reservation if quantity is adjusted to 0

* rename updateReservation to updateReservationItem

* update dto fields

* reference the correct fields

* update with transaction

* add jsdocs

* force boolean cast

* context-ize cancel and create fulfillment transaction methods

* undo notification cast

* update with changes

* refactor withTransaction to variable

* use maps

* fix service mocks
2023-01-09 14:44:34 +01:00
Riqwan Thamir
b280e53bd3 refactor(medusa): move repository specs into its own folder (#2952)
**What:**

Introduces a new folder under which repository specs will be placed. 

Why:

We don't currently have a good place to test ORM logic or custom queries against the database. The repository folder tests are a place for just exactly that. 

How:

Creates an internal package similar to other integration tests - api and plugins. 

CORE-965
2023-01-09 08:19:01 +00:00
Oliver Windall Juhl
8ba0addea3 chore(integration-tests): Add test for database options (#2707)
**What**
- Add integration test suite for database options
- Expose integration tests DB to additional options
- Add test for `idle_in_transaction_session_timeout`
2023-01-06 13:41:05 +00:00
Riqwan Thamir
3f44abe01a feat(medusa): Add ProductCategory model (#2945) 2023-01-05 19:10:46 +01:00