Commit Graph

4844 Commits

Author SHA1 Message Date
Riqwan Thamir
20243e22ee feat(pricing): pricing models are made soft deletable (#6732)
what:

- pricing models are made soft deletable
- adds missing timestamp attributes
- removes unwanted relationships + cascade cleanup
2024-03-20 16:03:17 +00:00
Stevche Radevski
70859397c0 feat: Align the product module HTTP API to follow our conventions (#6759) 2024-03-20 16:18:13 +01:00
Riqwan Thamir
4974f5e455 feat(utils): autogenerates create and update methods when dto is provided (#6751)
what:

when you provide an optional create_dto or update_dto to the model factory types, the abstract service will generate a simple service method for the public services of the modules.

```
MoneyAmount: {
  dto: PricingTypes.MoneyAmountDTO
  create_dto: PricingTypes.CreateMoneyAmountDTO
}
```

In the above example, only a create method will be generated, but the update will be skipped.
2024-03-20 14:33:24 +00:00
Philip Korsholm
64c2731e46 feat(medusa, core-flows): add ppdate inventory item endpoint (#6735)
* init update inventory item

* prep for pr
2024-03-20 14:45:06 +01:00
Oli Juhl
8155e2cfad feat: Init. v2 implementation in admin (#6715) 2024-03-20 14:28:28 +01:00
Adrien de Peretti
c658bd0233 feat(fulfillment): Events management (#6730)
**What**
This pr includes some cleanup and refactoring around the abstract event emitter method for the module service to not rely on a named class property but instead on resolution naming.

Includes fulfillment set events on creation. 

The idea is that if that pr allows us to align and agreed on the approach as well as including the cleanup for other pr to use, If this gets merged I ll continue with another pr to do the rest of the event management


partially fix CORE-1735
2024-03-20 12:44:26 +00:00
Adrien de Peretti
06f22bb48a fis(orchestration): Properly handle select all (#6742)
**What**
Fix select `*` without breaking select none `[]`
2024-03-20 12:09:54 +00:00
Stevche Radevski
05e857d256 feat: Update the signatures for variants and options to follow convention (#6748) 2024-03-20 11:31:54 +00:00
Oli Juhl
a859b7895e docs: Upgrade guide for v1.20.3 (#6753) 2024-03-20 11:12:53 +00:00
github-actions[bot]
53653f5266 chore(docs): Generated OAS (#6752)
Co-authored-by: olivermrbl <olivermrbl@users.noreply.github.com>
2024-03-20 11:30:24 +01:00
olivermrbl
95738804cd chore: Release 2024-03-20 10:35:07 +01:00
github-actions[bot]
26c9bada0a chore: Version Packages (#6360)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-03-20 10:21:30 +01:00
Frane Polić
189b03c485 feat(dashboard) admin 3.0 order edit (#6665)
**What**
- added Order Edit creation flow

**NOTES**
- since the state is managed on the server upon changing input / adding items a request is fired to update the edit
- on save we only confirm the edit

---

**TODO**
- [x] item removal functionality

---

https://github.com/medusajs/medusa/assets/16856471/01aa85ea-1fb1-4dff-9cf4-d8d79029c2cc
2024-03-20 07:54:22 +00:00
Sebastian Rindom
873c21355c feat: make it possible to use subscribers in v2 (#6731) 2024-03-19 18:31:58 +00:00
Stevche Radevski
db9c460490 feat: Add product and pricing link on create and delete operations (#6740)
Things that remain to be done:
1. Handle product and variant updates
2. Add tests for the workflows independently
3. Align the endpoints to the new code conventions we defined
4. Finish up the update/upsert endpoints for variants

All of those can be done in a separate PR, as this is quite large already.
2024-03-19 17:14:02 +00:00
Oli Juhl
3062605bce feat: Add products to sales channel (#6725)
Depends on #6722
2024-03-19 10:24:37 +00:00
Philip Korsholm
62d5803b20 Feat(core-flows, medusa): delete inventory item (#6708)
* initial get-inventory-item

* add exception throw test

* remove console log

* add changeset

* remove inventory item

* add changeset

* fix pr feedback

* use links

* use modules instead of property names
2024-03-19 10:40:18 +01:00
Philip Korsholm
c20eb15cd9 Feat(core-flows, medusa, types): Add delete location level api-v2 endpoint (#6727)
* add delete inventory level endpoint

* add changeset

* rename step

* rename step
2024-03-19 10:06:37 +01:00
Philip Korsholm
390bc3e72f Feat(core-flows, inventory-next, medusa, types): Add create inventory item endpoint (#6693)
* init create inventory item

* fix integration tests

* pr feedback

* rename to validate

* pr feedback

* bulk delete

* undo change w/ naming

* update dto body

* move integration test

* pr fixes

* fix for pr review

* revert medusa-config changes

* pr feedback

* fix build
2024-03-19 09:20:30 +01:00
Oli Juhl
0219a8677b feat: Sales Channels API routes + workflows (#6722)
**What**
- Admin sales channels API routes
- Workflows for creating, updating, and deleting sales channels
- Align `ISalesChannelModuleService` interface with update + upsert conventions
- Integrate v2 tests into v1 sales channels integration test suite
- Add metadata to sales channel entity

Sales channel <> Product management will come in a follow-up PR.

On the integration tests, creating, updating, and deleting are passing with the V2 flag enabled. You'll have to take my word for it (or run them yourself), as they are not included in the CI.
2024-03-18 20:57:29 +00:00
Adrien de Peretti
4b06c17dc0 fix(workflows-sdk): Value resolver should resolve non StepResponse (#6726) 2024-03-18 21:07:04 +01:00
Riqwan Thamir
0c705d7bd4 feat(core-flows,medusa,types): create/update workflows to create and update PriceList prices (#6711)
what:

- create and update workflows for price list prices
- update price list endpoint does a "set"
2024-03-18 14:14:28 +00:00
Philip Korsholm
84b8836cbf Feat(core-flows, inventory-next, medusa, types): Add create location level endpoint (#6695)
* initialize create location levels

* add enough from pr to make code build and test

* fix integration tests

* pr feedback

* fix errors

* rm dto

* Update packages/core-flows/src/inventory/steps/validate-inventory-locations.ts

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2024-03-18 10:28:57 +01:00
Adrien de Peretti
e77a02aca5 feat(): Update transformer middleware and API (#6647)
**What**
Update all transform middleware to support the new API
- deprecate `defaultRelations`
- deprecate `allowedRelations`
- Add `defaults` and `allowed` in replacement for `defaultFields` and `allowedFields` respectively
- in the `defaults` it is possible to specify a field such as `*variants` in order to be recognized as a relation only without specifying any property
- add support for `remoteQueryConfig` assigned to req like we have for `listConfig` and `retrieveConfig`
- add support to override `allowed|allowedFields` if a previous middleware have set it up on the req.allowed
- The api now accepts `fields` as the only accepted fields to manage the requested props and relations, the `expand` property have been deprecated. New supported symbols have been added in complement of the fields
  - `+` (e.g `/store/products?fields=+description`) to specify that description should be added as part of the returned data among the other defined fields
  - `-` (e.g `/store/products?fields=-description`) to specify that description should be removed as part of the returned data
  - `*` (e.g `/store/products?fields=*variants`) to specify that the variants relations should be added as part of the returned data among the other defined fields without having to specify which property of the variants should be returned. In the `defaults` config of the transform middleware it is also possible to use this symbol
  - In the case no symbol is provided, it will replace the default fields and mean that only the specified fields must be returned

About the allowed validation, all fields in the `defaults` configuration must be present in the `allowed` configuration. 
In case the `defaults` contains full relation selection (e.g `*product.variants`) it should be present in the `allowed` as `product.variants`. In case in the `defaults` you add `product.variants.id`, it will be allowed if the `allowed` configuration includes either `product.variants.id` as full match or `product.variants` as it means that we allow all properties from `product.variants`

Also, support for `*` selection on the remote query/joiner have been added


**Note**
All v2 end points refactoring can be done separately
2024-03-18 08:37:59 +00:00
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