medusajs / medusa

The world's most flexible commerce platform.
https://medusajs.com
MIT License
25.47k stars 2.53k forks source link

Property 'display_id' does not exist on type 'OrderDTO'. #9768

Open pixelwiese opened 3 days ago

pixelwiese commented 3 days ago

Add display_id to type AdminOrder in @medusajs/framework/types


Original Issue:

Bug report

Describe the bug

When i try to build the backend i get the error Property 'display_id' does not exist on type 'OrderDTO'.

The property is accessed in a subscriber. I checked the reference and could not see it there either. But in development i can still access the property and use it. It is also visible in the order json in the app.

System information

Medusa version (including plugins): 2.0.0 Node.js version: 20.10.0 Database: postgres Operating system: Mac Browser (if relevant): Chrome

Steps to reproduce the behavior

  1. Try to retrieve an Order and access the display_id
  2. run build
  3. see the error

Expected behavior

The display_id should be in the OrderDTO and throw no error.

olivermrbl commented 3 days ago

@pixelwiese, perhaps you can use the AdminOrder type from @medusajs/framework/types?

pixelwiese commented 3 days ago

@olivermrbl I imported import { Modules } from "@medusajs/framework/utils"

and this is the code i am using for retrieving the order: const order = await orderModuleService.retrieveOrder(orderId, { relations: ["summary", "summary.totals", "items", "items.tax_lines", "billing_address", "shipping_address", "shipping_methods", "shipping_methods.tax_lines"], select: ["total", "created_at"] })

also tried it with the "display_id" in select, but not sure if this is needed.

olivermrbl commented 3 days ago

What exactly is your issue? Is it that the type doesn't have display_id or the returned result?

pixelwiese commented 3 days ago

The Type does not have it and throws an error when i build the Backend. However display_id is returned.

Just realized I misunderstood your last comment. How would I use AdminOrder, I couldn't find it in the documentation.

olivermrbl commented 3 days ago

Until we add display_id to the OrderDTO, you can use the following:

import { AdminOrder } from "@medusajs/framework/types"