fix(medusa): Reservation routes and VariantInventory type (#3328)
This commit is contained in:
5
.changeset/funny-cars-crash.md
Normal file
5
.changeset/funny-cars-crash.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@medusajs/medusa": patch
|
||||
---
|
||||
|
||||
Register reservation endpoints + Fix a type issue for get variant inventory
|
||||
@@ -24,6 +24,7 @@ import productTypesRoutes from "./product-types"
|
||||
import publishableApiKeyRoutes from "./publishable-api-keys"
|
||||
import productRoutes from "./products"
|
||||
import regionRoutes from "./regions"
|
||||
import reservationRoutes from "./reservations"
|
||||
import returnReasonRoutes from "./return-reasons"
|
||||
import returnRoutes from "./returns"
|
||||
import salesChannelRoutes from "./sales-channels"
|
||||
@@ -97,6 +98,7 @@ export default (app, container, config) => {
|
||||
productTypesRoutes(route)
|
||||
publishableApiKeyRoutes(route)
|
||||
regionRoutes(route, featureFlagRouter)
|
||||
reservationRoutes(route)
|
||||
returnReasonRoutes(route)
|
||||
returnRoutes(route)
|
||||
salesChannelRoutes(route)
|
||||
|
||||
@@ -87,7 +87,7 @@ export default async (req, res) => {
|
||||
|
||||
const variant = await variantService.retrieve(id, { select: ["id"] })
|
||||
|
||||
const responseVariant: AdminGetVariantsVariantInventoryRes = {
|
||||
const responseVariant: VariantInventory = {
|
||||
id: variant.id,
|
||||
inventory: [],
|
||||
sales_channel_availability: [],
|
||||
@@ -150,7 +150,7 @@ type ResponseInventoryItem = Partial<InventoryItemDTO> & {
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminGetVariantsVariantInventoryRes
|
||||
* @schema VariantInventory
|
||||
* type: object
|
||||
* properties:
|
||||
* id:
|
||||
@@ -173,7 +173,7 @@ type ResponseInventoryItem = Partial<InventoryItemDTO> & {
|
||||
* description: Available quantity in sales channel
|
||||
* type: number
|
||||
*/
|
||||
export type AdminGetVariantsVariantInventoryRes = {
|
||||
export type VariantInventory = {
|
||||
id: string
|
||||
inventory: ResponseInventoryItem[]
|
||||
sales_channel_availability: {
|
||||
@@ -182,3 +182,15 @@ export type AdminGetVariantsVariantInventoryRes = {
|
||||
available_quantity: number
|
||||
}[]
|
||||
}
|
||||
|
||||
/**
|
||||
* @schema AdminGetVariantsVariantInventoryRes
|
||||
* type: object
|
||||
* properties:
|
||||
* variant:
|
||||
* type: object
|
||||
* $ref: "#/components/schemas/VariantInventory"
|
||||
*/
|
||||
export type AdminGetVariantsVariantInventoryRes = {
|
||||
variant: VariantInventory
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user