v2.1.0

medusajs/medusav2.1.0Dec 4, 2024by olivermrbl

AI Summary

This release improves order management by allowing email, shipping, and billing address updates, and adds check constraint support to the Data Model API.

Key Highlights

  • Orders can now have their email, shipping address, and billing address updated.
  • Support for Postgres check constraints has been added to the Data Model API.
  • Pricing, User, and Auth modules have been migrated to DML with specific schema changes.
  • The admin dashboard has been translated into Italian.

New Features

  • Add operator field to price rule.
  • Add price rule operators to price calculations.
  • Ability to update/create custom shipping prices.
  • List shipping options passing cart as pricing context.
  • Migrate pricing entities to DML models.
  • Add support for check constraints in DML.
  • Ability to update orders.
  • Update order forms.

Full Release Notes

<!-- 
![order-update](https://github.com/user-attachments/assets/40b24b05-d20c-4ab1-8d39-32a275e7e0a4)

# v2.1.0

This version improves order management with support for updating email, shipping address, and billing address.

CMS_BREAK -->

## Highlights

### Improved order management

We've improved our order management with support for updating email, shipping address, and billing address.

### New languages

Our admin dashboard has been translated into Italian.

### Support for check constraint in Data Model API

We've added support for Postgres check constraints in our Data Model API.

For example:
```ts
const shippingMethod = model.define('ShippingMethod', {
  amount: model.bigNumber(),
})
.checks([
  (columns) => `${columns.amount} >= 0`
])
```

### DML Migrations
> [!WARNING]  
Schema changes

We've migrated our Pricing, User, and Auth modules to use our Data Model API. These migrations include minor changes to the database schema:

**Pricing module**
- Added column `operator` to `price_rule` table (defaults to `eq`)
- Created index on `(operator)` in `price_rule` table
- Created index on `(price_id)` in `price_rule` table
- Created unique index on `(price_id, attribute, operator)` in `price_rule` table
- Changed type of `max_quantity` column in `price` table from numeric to integer
- Changed type of `min_quantity` column in `price` table from numeric to integer

**Auth module**
- Added column `deleted_at` to `auth_identity` table
- Added column `deleted_at` to `provider_identity` table 
- Created index on `(deleted_at)` in `auth_identity` table 
- Created index on `(deleted_at)` in `provider_identity` table 

**User module**
- Renamed unique index on `(email)` in `invite` table
- Renamed unique index on `(email)` in `user` table

**Required actions**

Run migrations to ensure your server functions as expected after upgrading to v2.1.0:
```
npx medusa db:migrate
```

## Features
* feat(pricing,utils,types): add operator field to price rule by @riqwan in https://github.com/medusajs/medusa/pull/10315
* feat(pricing, types): add price rule operators to price calculations by @riqwan in https://github.com/medusajs/medusa/pull/10350
* feat(core-flows,types,medusa): ability to update/create custom shipping prices by @riqwan in https://github.com/medusajs/medusa/pull/10368
* feat(core-flows,framework,medusa): list shipping options pass in cart as pricing context by @riqwan in https://github.com/medusajs/medusa/pull/10374
* refactor: migrate pricing entities to DML models by @thetutlage in https://github.com/medusajs/medusa/pull/10335
* feature: add support for check constraints in DML by @thetutlage in https://github.com/medusajs/medusa/pull/10391
* feat(core-flows,medusa,order,types): update orders by @fPolic in https://github.com/medusajs/medusa/pull/10373
* feat(admin, js-sdk, types): update order forms by @fPolic in https://github.com/medusajs/medusa/pull/10418
## Bugs
* fix(medusa): remove request body type argument from cancel order transfer routes by @shahednasser in https://github.com/medusajs/medusa/pull/10327
* fix(product): change export name of ProductImage by @shahednasser in https://github.com/medusajs/medusa/pull/10326
* fix: Use the correct defaults for the invite token expiry by @sradevski in https://github.com/medusajs/medusa/pull/10344
* fix: do not initialize FKs to null by @thetutlage in https://github.com/medusajs/medusa/pull/10337
* fix(order): archive order status update by @fPolic in https://github.com/medusajs/medusa/pull/10340
* fix: do not rely on model loading order to find an implicit owner by @thetutlage in https://github.com/medusajs/medusa/pull/10360
* fix(ui,icons,ui-preset): Fix CodeBlock and Command components by @kasperkristensen in https://github.com/medusajs/medusa/pull/10369
* fix: Ensure tax lines are generated for all items and shipping methods in cart by @olivermrbl in https://github.com/medusajs/medusa/pull/10372
* fix(stock-location): Fix export of StockLocation module by @kasperkristensen in https://github.com/medusajs/medusa/pull/10406
* fix(dashboard): Fix broken number input in adjust inventory form by @kasperkristensen in https://github.com/medusajs/medusa/pull/10416
* fix(dashboard): Add default value to inventory item combobox by @kasperkristensen in https://github.com/medusajs/medusa/pull/10412
* fix(dashboard): Prevent language ptBR from breaking dashboard by @kasperkristensen in https://github.com/medusajs/medusa/pull/10422
* fix(framework): Ensure that CORS and Auth middleware is applied for routes only defined in middlewares.ts by @kasperkristensen in https://github.com/medusajs/medusa/pull/10339
* fix(dashboard): Add Shipping Profile metadata route by @kasperkristensen in https://github.com/medusajs/medusa/pull/10430
## Documentation
* docs: update sanity guide + marketplace recipe to use permanentFailure by @shahednasser in https://github.com/medusajs/medusa/pull/10310
* docs: update details on retrieving nested categories by @shahednasser in https://github.com/medusajs/medusa/pull/10317
* docs: add note about actor_type in reset password event in v2.0.7 by @shahednasser in https://github.com/medusajs/medusa/pull/10322
* docs: update many-to-many docs by @shahednasser in https://github.com/medusajs/medusa/pull/10323
* docs: generate references manually by @shahednasser in https://github.com/medusajs/medusa/pull/10325
* docs: revise implement brand module by @shahednasser in https://github.com/medusajs/medusa/pull/10341
* docs: revised build custom features chapter by @shahednasser in https://github.com/medusajs/medusa/pull/10338
* docs: revise create brand workflow by @shahednasser in https://github.com/medusajs/medusa/pull/10346
* docs: changes to deployment + remove admin deployment guides by @shahednasser in https://github.com/medusajs/medusa/pull/10345
* docs: document permanentFailure by @shahednasser in https://github.com/medusajs/medusa/pull/10356
* docs: add note about retryInterval making workflow long-running by @shahednasser in https://github.com/medusajs/medusa/pull/10355
* docs: intro + basic chapter fixes by @shahednasser in https://github.com/medusajs/medusa/pull/10361
* docs: remove v2 branch of next js starter installation by @shahednasser in https://github.com/medusajs/medusa/pull/10402
* docs: add missing import to db operations documentation by @shahednasser in https://github.com/medusajs/medusa/pull/10390
* docs: revise brand API route by @shahednasser in https://github.com/medusajs/medusa/pull/10352
* docs-util: add user, pricing, and auth as modules with DML by @shahednasser in https://github.com/medusajs/medusa/pull/10423
* docs: fixes and improvements to Sanity guide by @shahednasser in https://github.com/medusajs/medusa/pull/10414
## Chores
* Fix(dml): DML default/nullable management by @adrien2p in https://github.com/medusajs/medusa/pull/10363
* chore(utils): Ensure DML name convention follow the same as the class  name for simplicity by @adrien2p in https://github.com/medusajs/medusa/pull/10370
* feat(auth): Migrate auth module to DML by @adrien2p in https://github.com/medusajs/medusa/pull/10387
* feat(user): Migrate user module to DML by @adrien2p in https://github.com/medusajs/medusa/pull/10389
* chore(workflows-sdk): add unit test by @carlos-r-l-rodrigues in https://github.com/medusajs/medusa/pull/10419
## Other Changes
* German language corrections by @pixelwiese in https://github.com/medusajs/medusa/pull/10394
* feat: added Italian translations by @MarcoSan19 in https://github.com/medusajs/medusa/pull/10362
* Fix French translation typos by @lucienbl in https://github.com/medusajs/medusa/pull/10348

## New Contributors
* @MarcoSan19 made their first contribution in https://github.com/medusajs/medusa/pull/10362
* @lucienbl made their first contribution in https://github.com/medusajs/medusa/pull/10348

**Full Changelog**: https://github.com/medusajs/medusa/compare/v2.0.7...v2.1.0