Commit Graph

4820 Commits

Author SHA1 Message Date
Shahed Nasser
bb87db8342 docs: prep for v2 documentation (#6710)
This PR includes documentation that preps for v2 docs (but doesn't introduce new docs).

_Note: The number of file changes in the PR is due to find-and-replace within the `references` which is unavoidable. Let me know if I should move it to another PR._

## Changes

- Change Medusa version in base OAS used for v2.
- Fix to docblock generator related to not catching all path parameters.
- Added typedoc plugin that generates ER Diagrams, which will be used specifically for data model references in commerce modules.
- Changed OAS tool to output references in `www/apps/api-reference/specs-v2` directory when the `--v2` option is used.
- Added a version switcher to the API reference to switch between V1 and V2. This switcher is enabled by an environment variable, so it won't be visible/usable at the moment.
- Upgraded docusaurus to v3.0.1
- Added new Vale rules to ensure correct spelling of Medusa Admin and module names.
- Added new components to the `docs-ui` package that will be used in future documentation changes.
2024-03-18 07:47:35 +00:00
Philip Korsholm
56a6ec0227 feat(medusa): Add get inventory item endpoint (#6704)
* initial get-inventory-item

* add exception throw test

* remove console log

* add changeset

* remove unused import
2024-03-15 16:00:27 +01:00
Adrien de Peretti
3188e703b3 feat(fulfillment): Separate list and context rules validation (#6674)
**What**

- Add method to validate fulfillment option from the provider
- Separate list/list and count from context rules validation and add listShippingOptionsForContext

FIXES CORE-1861
2024-03-15 13:25:51 +00:00
Stevche Radevski
1956dce80a feat: Update the product options model and refactor the product module (#6685)
The changes in this PR are:
1. Change how product options are created and stored. The relationship changed from
`options --> option values <-- variants`
to
`options --> option values --> variant options <-- variants`

Now we can enforce non-duplicate option values, easier creation and updates of options, and more.

2. Refactors the product module. The product module did a lot of things in a non-ideal approach, and this is a step towards a more consistent usage of the base repository and methods exposed by a module. There is still work left to improve the module, but a large chunk of the changes are included in this PR


Things to do as a follow-up:
1. Remove many-to-many relationships  if an empty list is passed in the base repository.
2. Improve the typings of the module
3. Further cleanup and improvements (there are few questions that I need answered before I can improve the API)
2024-03-15 12:35:46 +00:00
Frane Polić
a1b4aff127 feat(dashboard): manage discounts conditions (#6620)
**What**
- forms for managing discount conditions

---

https://github.com/medusajs/medusa/assets/16856471/bb0b3fe8-fa60-479b-bc42-6db9d422bcdf





Co-authored-by: Kasper Fabricius Kristensen <45367945+kasperkristensen@users.noreply.github.com>
2024-03-15 11:56:23 +00:00
Riqwan Thamir
9288f53327 feat(core-flows,medusa,pricing,types,utils): added price list workflows + endpoints (#6648)
Apologies for the giant PR in advance, but most of these are removing of files and migrations from old workflows and routes to new.

What:

- Adds CRUD endpoints for price lists
- Migrate workflows from old sdk to new
- Added missing updatePriceListPrices method to pricing module
2024-03-15 11:09:02 +00:00
Kasper Fabricius Kristensen
c3f26a6826 feat(dashboard,medusa): Draft order detail (#6703)
**What**
- Adds draft order details page
- Adds Shipping and Billing address forms to both draft order and order pages
- Adds Email form to both draft order and order pages
- Adds transfer ownership form to draft order, order and customer pages
- Update Combobox component allowing it to work with async data (`useInfiniteQuery`)

**@medusajs/medusa**
- Include country as a default relation of draft order addresses
2024-03-15 10:29:59 +00:00
Stevche Radevski
68d869607f chore: Use module test runner in all modules (#6706)
I replaced the custom test setup with the test runner. This should make migrating to mikroorm 6 a lot easier once we do it.

There are few more modules to be done, but I thought the PR is super big already so we can tackle them separately.

Note that there are no or very little test changes, it is mostly the setup around the tests.
2024-03-14 21:01:50 +00:00
Oli Juhl
1eb90f739b chore: Update version bump from minor to patch (#6699) 2024-03-14 21:19:55 +01:00
Oli Juhl
8f8a4f9b13 chore: Bump all modules (#6700) 2024-03-14 21:11:12 +01:00
Riqwan Thamir
e5945479e0 feat(medusa,core-flows,types): adds update promotion rule endpoint + workflow (#6702)
what:

- adds endpoint + workflow to update promotion rule
- adds method in promotion to update promotion rules
2024-03-14 20:04:53 +00:00
Riqwan Thamir
7be0a2cf6d chore(medusa): use batch/add and batch/remove endpoints for promotion rules (#6701) 2024-03-14 19:07:48 +01:00
Kasper Fabricius Kristensen
c384ede3b1 feat(dashboard): Setup parallel V2 routes (#6691)
**What**
- Moves all current route definitions to `v1.tsx`
- Creates a new `v2.tsx` file for future V2 routes.
- Updates RouteProvider to serve V1 or V2 routes based on if `MEDUSA_V2` is set.

**How to use it**
When working on V2 domains you should set `MEDUSA_V2=true` in `/packages/admin-next/dashboard/.env`. We can't use the Feature Flag in the Medusa project since there are breaking changes in the `/admin/store` endpoint between the two versions, so it needs to be managed manually.

**For people implementing V2 domains**
To add a new route you should:

- Add the route component in `/v2-routes`
- Define which path will render it in `v2.tsx`.

I would prefer that we don't try to implement a lot of conditional code that will make the codebase unnecessarily complex. So if I was to implement the V2 login page, I would copy/past the v1 login route into `v2-routes`, make the required changes, eg. replace `useAdminLogin` with `useAdminCustomPost(...)`, instead of trying to force the current V1 Login page to work with both APIs.

There will hopefully be a lot of components/sections from each domain that is re-usable between versions. As an example if you are working on the Product details page for V2 you might want to reuse the `product-general-section.tsx` file, as it works without having to make any modifications. In that case I propose that we create a `modules/product` folder and move the component in there which we can them import into both the v1 and v2 version of the route.
2024-03-14 18:05:44 +00:00
Riqwan Thamir
cc1b66842c feat(core-flows,medusa,types,utils): add/remove fulfillment shipping option rules (#6698)
what:

- adds fulfillment shipping option rules batch endpoint
- remove fulfillment shipping option rules batch endpoint
- breaks my British based education to not call it fulfilment with a single "l"
2024-03-14 16:02:50 +00:00
Shahed Nasser
480b4744af fix(dashboard): fixed some strings (#6686)
Fixed some strings in the admin dashboard.
2024-03-14 15:43:14 +00:00
Riqwan Thamir
1a661adf3e feat(medusa,types): GET admin promotion endpoint to fetch by code (#6697)
what:

- GET admin promotion endpoint will search for a promotion either through ID or code
2024-03-14 15:13:53 +00:00
Philip Korsholm
c3f8c30ba6 Feat(inventory-next, medusa): Add List inventory items endpoint (#6694)
* code for list inventory items

* fix integration tests

* move integration test

* calculate reserved and stocked quantities in db

* update lockfile
2024-03-14 14:48:34 +01:00
Sebastian Rindom
3dd55efd15 Fix/load medusa proj (#6639)
**What**
- Runs loadMedusaV2 when v2 flag is enabled.
- V2 loader loads only project-level framework features. E.g., project APIs, subscribers, jobs, and workflows.
- No plugin support yet.
2024-03-14 12:38:57 +00:00
Riqwan Thamir
04a532e5ef feat(core-flows,medusa,types): remove rules from promotion endpoints + workflows (#6696) 2024-03-14 09:19:05 +01:00
Riqwan Thamir
640eccd5dd feat(core-flows,medusa,types,utils): add rules to promotion endpoints + workflow (#6692)
* feat(core-flows,medusa,types,utils): add rules to promotion endpoints + workflow

* chore: fix specs

* chore: move input type to types package
2024-03-13 21:19:24 +01:00
Oli Juhl
02e784ce78 feat: Confirm inventory in create cart workflow (#6635) 2024-03-13 18:24:08 +01:00
Riqwan Thamir
b78f863d80 feat(core-flows,medusa): added api + workflows for rule types CRUD (#6684) 2024-03-13 16:43:30 +01:00
Oli Juhl
5f6d128613 chore: Update CODEOWNERS (#6682)
Prepare CODEOWNERS file for reviewer auto-assignment by isolating the ownership of the engineering team to packages. Without this, the team would be asked to review docs PRs too.
2024-03-13 12:52:16 +01:00
Oli Juhl
25d176b851 feat: List shipping options for cart (#6677) 2024-03-13 09:08:47 +00:00
Oli Juhl
db26dafa85 chore: Use module test runner in Carts API test suite (#6679)
Nothing but migrating to our new module test runner. Hopefully, that'll make the actual test PRs easier to digest.
2024-03-13 07:32:58 +00:00
Riqwan Thamir
d4b921f3db feat(medusa,pricing,types): added get endpoints for pricing rule types (#6678)
what:

- adds list endpoint for rule types
- adds get endpoint for rule types
2024-03-12 17:35:24 +00:00
Oli Juhl
f0c8142635 feat: Add shipping method to cart (#6661) 2024-03-12 17:52:48 +01:00
Riqwan Thamir
c3c4f49fc2 feat(core-flows,medusa,types): add automatic-taxes to region + generate tax lines endpoint (#6667)
what:

- endpoint to generate tax lines
- update workflows to force calculate tax lines with a flag
- added automatic_taxes to region
2024-03-12 14:36:22 +00:00
Adrien de Peretti
87e63c024e feat(fulfillment): Migration backward compatibility (#6672)
**What**
- Update migration for backward compatibility. This does not take into account data migration and table cleanup (@olivermrbl do we have a general tasks for the modules on that subject)?
- Rename fulfillment provider id to provider id
- add integration tests to ensure the migration backward compatibility
- add new module type for the options to be used in the medusa config for example

FIXES CORE-1724
2024-03-12 13:53:33 +00:00
Oli Juhl
e82b4788ec fix(fulfillment): Fulfillment set file name typo (#6671) 2024-03-12 10:08:39 +01:00
Carlos R. L. Rodrigues
a8794d48de fix(orchestrator): inject only if it has decorator (#6666) 2024-03-12 08:11:33 +01:00
Carlos R. L. Rodrigues
d48c076b77 chore(order): big number calculations (#6651)
Co-authored-by: Adrien de Peretti <25098370+adrien2p@users.noreply.github.com>
2024-03-11 17:51:00 +00:00
Riqwan Thamir
7c46b0f88b feat(medusa): added list price list products endpoint (#6617)
what:

- adds an endpoint to list price list products
2024-03-11 17:00:16 +00:00
pepijn-vanvlaanderen
c154336433 fix: Fix missing product category relation in ProductSearchSubscriber (#6555) 2024-03-11 16:59:52 +01:00
Adrien de Peretti
d9d5afc3cf feat(fulfillment): Soft deletes (#6630)
**What**
- Ensure soft delete works properly according to the soft delete configuration and validate all relation of the entire data model
- Add is_enabled to the providers in order to manage new providers to enabled or disabled
- include joiner config update

FIXES CORE-1853
FIXES CORE-1830
FIXES CORE-1719
2024-03-11 15:56:08 +00:00
Kasper Fabricius Kristensen
78e5ec459a feat(dashboard,medusa): Draft order list page (#6658)
**What**
- (dashboard) Adds list page for Draft Order domain
- (medusa) Adds the ability to filter draft orders
2024-03-11 13:22:35 +00:00
Oli Juhl
c51a67a421 feat: Add payment + promotion refreshing to cart workflows (#6654)
Add payment collection refreshing to:
- Add to cart
- Create cart
- Update line item in cart

Add promotion creation to:
- Create cart
2024-03-11 12:32:41 +00:00
Kasper Fabricius Kristensen
ee4ea796f6 chore: align version of dotenv (#6657) 2024-03-11 12:34:17 +01:00
Stevche Radevski
ff4bd62f71 feat: Implement missing methods in product module and make more tests pass (#6650)
The 2 bigger remaining tasks are:
1. handling prices for variants
2. Handling options (breaking change)

After that all tests should pass on both v1 and v2
2024-03-11 11:03:24 +00:00
Kasper Fabricius Kristensen
e124762873 feat(medusa,dahsboard): Initial work on pricing domain (#6633)
**What**
- Initial work on pricing domain.
- List page
- Details page
- Partial edit form
- Fixes admin/price-lists/:id/products endpoint to allow filtering products by multiple ids.

**Note**
Pushing this now as the current design need a bit of tweaking so we display all relevant data to users. Future PR will include completed Edit moda, Create modal, Edit prices modal and Add prices modal.
2024-03-11 09:56:41 +00:00
Kasper Fabricius Kristensen
b8bedb84cf feat(dashboard): Return Reasons domain (#6640)
**What**
- Adds Return Reason domain.
2024-03-11 09:10:56 +00:00
Kasper Fabricius Kristensen
fb25471e92 feat(dashboard): Reservations and inventory item list pages (#6550)
**What**
- Adds list page for reservations and inventory items
- Adds new String filter type, that allows users to filter by a string, eg. "material === 'metal'"
- Adds new Number filter type, that allows users to filter by a number or numerical comparator, eg. quantity === 10 / quantity is gt 10 and lt 50.
2024-03-11 08:40:25 +00:00
Shahed Nasser
d38b5eb790 docs: fix migrations path in extend entity docs (#6645) 2024-03-11 08:44:53 +01:00
Frane Polić
39e73b2d2f feat(dashboard) admin 3.0 create discounts form (#6590) 2024-03-11 08:06:27 +01:00
Kasper Fabricius Kristensen
2d00625729 feat(dashboard): Workflow executions (#6564)
**What**
- v1 of executions domain

**TODO in follow up PR**
I think it might be a good idea for Carlos or Adrien to go over the design with Ludvig, and make sure we are displaying what is relevant to developers, and how things should be displayed. So this PR is just the initial implementation, and does not handle displaying things like compensation steps (not part of the current design), step input (not supported by the API but part of the design), etc.

Closes CORE-1751, CORE-1755
2024-03-09 18:46:10 +00:00
Sebastian Rindom
a838ebae1b fix: make v2 with modules run (#6636) 2024-03-09 15:09:06 +00:00
Kasper Fabricius Kristensen
c2d56ca12b feat(medusa,dashboard): Tax settings pages and fixes to list tax rates endpoint (#6606)
**What**
- Adds pages for managing tax settings and tax rates for regions.
- Fixes `list` tax rates endpoint, which was missing pagination, search, order, and filters.

**Note**
The fix to the tax rate list endpoint is very rough, as I have had to reimplement most of the logic from our transformQuery middleware. This is because this endpoints does not follow normal convention for fields and expand and uses string arrays instead of strings separated by commas. Our middleware does not support this, and changing the endpoint to align with other endpoints on the expand and fields params would be a breaking change. Since this is very temporary until 2.0 I think it's okay for the time being.

CLOSES CORE-1654
2024-03-09 13:19:29 +00:00
Minh Tu Ngo
7109969874 docs: Heroku typo (#6629) 2024-03-08 17:01:30 +00:00
Mads Jensen
56504c99f0 bug: fix constraint on customer table to allow soft-deletes (#6631) 2024-03-08 16:43:11 +01:00
Oli Juhl
4136b9da5f feat: Add Sales Channel Stock Location link (#6634) 2024-03-08 15:26:26 +01:00