feat(core-flows,types,medusa): validate deleting location level when quantities exist (#9086)

what:

- adds validation in workflow to prevent deleting a location level when reserved or stocked quantity exists
- disabled delete button when quantities exist
- consolidate delete workflows

<img width="1079" alt="Screenshot 2024-09-10 at 16 39 02" src="https://github.com/user-attachments/assets/cf1f4b2e-75ea-4f7c-9b97-24622396c632">

RESOLVES CC-120
This commit is contained in:
Riqwan Thamir
2024-09-10 17:59:03 +00:00
committed by GitHub
parent 4bf42f7889
commit c097931469
8 changed files with 108 additions and 87 deletions
@@ -9,9 +9,9 @@ import {
deleteInventoryLevelsWorkflow,
updateInventoryLevelsWorkflow,
} from "@medusajs/core-flows"
import { HttpTypes } from "@medusajs/types"
import { refetchInventoryItem } from "../../../helpers"
import { AdminUpdateInventoryLocationLevelType } from "../../../validators"
import { HttpTypes } from "@medusajs/types"
export const DELETE = async (
req: MedusaRequest,
@@ -45,7 +45,7 @@ export const DELETE = async (
await deleteInventoryLevelWorkflow.run({
input: {
ids: [levelId],
id: [levelId],
},
})