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:
Shahed Nasser
2024-08-30 10:15:02 +03:00
committed by GitHub
parent 9f495fd853
commit 0ee5c2d501
57 changed files with 145 additions and 106 deletions

View File

@@ -10,7 +10,7 @@ import {
import { refetchApiKey } from "../helpers"
import { AdminUpdateApiKeyType } from "../validators"
import { MedusaError } from "@medusajs/utils"
import { DeleteResponse, HttpTypes } from "@medusajs/types"
import { HttpTypes } from "@medusajs/types"
export const GET = async (
req: AuthenticatedMedusaRequest,
@@ -54,7 +54,7 @@ export const POST = async (
export const DELETE = async (
req: AuthenticatedMedusaRequest,
res: MedusaResponse<DeleteResponse<"api_key">>
res: MedusaResponse<HttpTypes.AdminApiKeyDeleteResponse>
) => {
const id = req.params.id