This also includes rework of the currency model for the Store module.
This change is breaking as existing stores won't have any supported currencies set, so users would need to go to the store settings again and choose the supported currencies there.
**What**
Update the `MedusaService` class, factory and types to remove the concept of main modules. The idea being that all method will be explicitly named and suffixes to represent the object you are trying to manipulate.
This pr also includes various fixes in different modules
Co-authored-by: Stevche Radevski <4820812+sradevski@users.noreply.github.com>
Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
what:
Multiple active sessions are used for split payments. We don't currently support split payments. Until we have that implemented, this change is to ensure that whenever we create a new payment session, we delete an existing session if present.
RESOLVES CORE-2284
* feat: Normalize the categories interface to match standards
* feat: Revamp the product category implementation
* fix: Adjustments to code and tests around product categories
There are a lot of issues in the admin after applying the correct typings, but fixing those should be done gradually, it's better to keep it out of this PR
* chore: ability to group events on redis event bus
* chore: fix tests
* Update packages/modules/event-bus-redis/src/services/event-bus-redis.ts
Co-authored-by: Adrien de Peretti <adrien.deperetti@gmail.com>
* chore: change shape of input and body data
* chore: fix builds
* chore: address comments
* chore: fix unit test
---------
Co-authored-by: Adrien de Peretti <adrien.deperetti@gmail.com>
what:
- santizes inputs to prevent reserved_quantity from being updated directly
- inventory items create api can create location levels
- add validation to update quantity of reservation items
- general cleanup
RESOLVES CORE-2254
* chore: Move publishable api key tests to HTTP
* chore: Move store tests to HTTP folder
* fix: Add tests for store products, fix several bugs around publishable keys
what:
When creating a variant, we can now create inventory as a part of the product and variants create endpoint.
This applies only to variants where `manage_inventory=true`. 2 cases present itself:
1. When inventory_items are present
- Link an inventory item with required_quantity to the variant
- the inventory item already needs to be present
2. When inventory_items are not present
- A default inventory item will be created
- links the created item to the variant with a default required_quantity
RESOLVES CORE-2220
what:
- adds variant inventory link management endpoints:
```
Link inventory item to variant
POST /products/:id/variants/:vid/inventory-items
Update variant's inventory item link
POST /products/:id/variants/:vid/inventory-items/:iid
Unlink variant's inventory item
DELETE /products/:id/variants/:vid/inventory-items/:iid
```
- a batch endpoint that does the above 3 across variants
```
POST /products/:id/variants/inventory-items
```
What
- Move sales channel integration tests from `/api` to `/http`
Deleted tests that do not belong in the suite:
- POST /admin/products/:id
- Mutation sales channels on products
- POST /admin/products
- Creating a product with a sales channel
- GET /admin/products
- Filtering products by sales channel
- Expanding with a sales channel
- GET /admin/orders
- Filtering orders by sales channel
- Expanding with a sales channel
- POST /admin/orders/:id/swaps
- Creating a swap with a sales channel
* chore: Move api key tests to http folder
* chore: Move some of the product category tests to http
* chore: Move collection tests to http
* chore: Remove unused database test
what:
- when inventory_quantity is requested through the API, we calculate the inventory based on sales channels + stock locations and return the total available inventory.
A variant can have multiple inventory items. As an example:
Table: (variant)
- 4 (required_quantity via link) x legs (inventory item)
- 2 x table top
Only if all individual inventory items of a variant are available, do we mark the variant as available as a single unit.
RESOLVES CORE-2187