fix(medusa): use correct request and response types for batch location levels route (#11055)

Use HTTP types for request / response types of the new batch location levels route
This commit is contained in:
Shahed Nasser
2025-01-20 19:03:07 +02:00
committed by GitHub
parent 24a952a83a
commit 45b47bf813
4 changed files with 30 additions and 3 deletions

View File

@@ -0,0 +1,5 @@
---
"@medusajs/medusa": patch
---
fix(medusa): use correct request and response types for batch location levels route

View File

@@ -104,9 +104,25 @@ export interface AdminBatchUpdateInventoryItemsLocationLevels
id?: string
}
/**
* A list of inventory levels to create, update, or delete.
*/
export interface AdminBatchInventoryItemsLocationLevels {
/**
* The inventory levels to create.
*/
create: AdminBatchCreateInventoryItemsLocationLevels[]
/**
* The inventory levels to update.
*/
update: AdminBatchUpdateInventoryItemsLocationLevels[]
/**
* The IDs of the inventory levels to delete.
*/
delete: string[]
/**
* If enabled, the inventory levels will be deleted
* even if they have stocked quantity.
*/
force?: boolean
}

View File

@@ -15,6 +15,9 @@ export type AdminInventoryLevelListResponse = PaginatedResponse<{
inventory_levels: InventoryLevel[]
}>
/**
* The result of creating, updating or deleting inventory levels.
*/
export interface AdminBatchInventoryItemLocationLevelsResponse {
/**
* The created inventory levels.
@@ -30,5 +33,8 @@ export interface AdminBatchInventoryItemLocationLevelsResponse {
deleted?: string[]
}
/**
* The result of creating, updating or deleting inventory levels.
*/
export interface AdminBatchInventoryItemsLocationLevelsResponse
extends AdminBatchInventoryItemLocationLevelsResponse {}

View File

@@ -1,10 +1,10 @@
import { batchInventoryItemLevelsWorkflow } from "@medusajs/core-flows"
import { MedusaRequest, MedusaResponse } from "@medusajs/framework"
import { AdminBatchInventoryItemLevelsType } from "../../validators"
import { HttpTypes } from "@medusajs/types"
export const POST = async (
req: MedusaRequest<AdminBatchInventoryItemLevelsType>,
res: MedusaResponse
req: MedusaRequest<HttpTypes.AdminBatchInventoryItemsLocationLevels>,
res: MedusaResponse<HttpTypes.AdminBatchInventoryItemsLocationLevelsResponse>
) => {
const body = req.validatedBody