fix(dashboard, js-sdk, types, medusa): separate between delete response with and without parent (#8852)
- Separate the previous `DeleteResponse` to `DeleteResponse` and `DeleteResponseWithParent`, as not every API route's delete response returns a parent. This ensures more accurate types shown in OAS / documentation. - Use `DeleteResponse` or `DeleteResponseWithParent` in response API routes based on what they return - Remove direct usage of `DeleteResponse` in API route, and instead create a type in the `type` package specific for the route / domain. - Use the new types in the `js-sdk` and `dashboard`.
This commit is contained in:
@@ -13,7 +13,7 @@ import {
|
||||
} from "@medusajs/utils"
|
||||
import { AdminCreateCustomerAddressType } from "../../../validators"
|
||||
import { refetchCustomer } from "../../../helpers"
|
||||
import { AdditionalData, DeleteResponse, HttpTypes } from "@medusajs/types"
|
||||
import { AdditionalData, HttpTypes } from "@medusajs/types"
|
||||
|
||||
export const GET = async (
|
||||
req: AuthenticatedMedusaRequest,
|
||||
@@ -61,7 +61,7 @@ export const POST = async (
|
||||
|
||||
export const DELETE = async (
|
||||
req: AuthenticatedMedusaRequest,
|
||||
res: MedusaResponse<DeleteResponse<"customer_address">>
|
||||
res: MedusaResponse<HttpTypes.AdminCustomerAddressDeleteResponse>
|
||||
) => {
|
||||
const id = req.params.address_id
|
||||
const deleteAddress = deleteCustomerAddressesWorkflow(req.scope)
|
||||
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
deleteCustomersWorkflow,
|
||||
updateCustomersWorkflow,
|
||||
} from "@medusajs/core-flows"
|
||||
import { AdditionalData, DeleteResponse, HttpTypes } from "@medusajs/types"
|
||||
import { AdditionalData, HttpTypes } from "@medusajs/types"
|
||||
import { MedusaError } from "@medusajs/utils"
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
@@ -55,7 +55,7 @@ export const POST = async (
|
||||
|
||||
export const DELETE = async (
|
||||
req: AuthenticatedMedusaRequest,
|
||||
res: MedusaResponse<DeleteResponse<"customer">>
|
||||
res: MedusaResponse<HttpTypes.AdminCustomerDeleteResponse>
|
||||
) => {
|
||||
const id = req.params.id
|
||||
const deleteCustomers = deleteCustomersWorkflow(req.scope)
|
||||
|
||||
Reference in New Issue
Block a user