chore(medusa,types): [10] Add request types to API routes (#8567)
This commit is contained in:
1 parent
61cbc8c0be
commit
b78e286224
17 files changed
+76
-32
No files matched your search
@@ -1,4 +1,5 @@
|
|||||||
import { DeleteResponse, PaginatedResponse } from "../../common"
|
import { DeleteResponse, PaginatedResponse } from "../../common"
|
||||||
|
import { AdminPrice } from "../../pricing"
|
||||||
import { AdminPriceList } from "./entities"
|
import { AdminPriceList } from "./entities"
|
||||||
|
|
||||||
export interface AdminPriceListResponse {
|
export interface AdminPriceListResponse {
|
||||||
@@ -12,3 +13,13 @@ export interface AdminPriceListListResponse
|
|||||||
|
|
||||||
export interface AdminPriceListDeleteResponse
|
export interface AdminPriceListDeleteResponse
|
||||||
extends DeleteResponse<"price_list"> {}
|
extends DeleteResponse<"price_list"> {}
|
||||||
|
|
||||||
|
export interface AdminPriceListBatchResponse {
|
||||||
|
created: AdminPrice[]
|
||||||
|
updated: AdminPrice[]
|
||||||
|
deleted: {
|
||||||
|
ids: string[]
|
||||||
|
object: "price"
|
||||||
|
deleted: boolean
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -29,3 +29,11 @@ export interface AdminProduct
|
|||||||
tags?: AdminProductTag[] | null
|
tags?: AdminProductTag[] | null
|
||||||
}
|
}
|
||||||
export type AdminProductStatus = ProductStatus
|
export type AdminProductStatus = ProductStatus
|
||||||
|
export interface AdminProductVariantInventoryLink {
|
||||||
|
productService: {
|
||||||
|
variant_id: string
|
||||||
|
}
|
||||||
|
inventoryService: {
|
||||||
|
inventory_item_id: string
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ import {
|
|||||||
AdminProduct,
|
AdminProduct,
|
||||||
AdminProductOption,
|
AdminProductOption,
|
||||||
AdminProductVariant,
|
AdminProductVariant,
|
||||||
|
AdminProductVariantInventoryLink,
|
||||||
} from "./entitites"
|
} from "./entitites"
|
||||||
import { AdminInventoryItem } from "../../inventory"
|
import { AdminInventoryItem } from "../../inventory"
|
||||||
|
|
||||||
@@ -59,3 +60,18 @@ export type AdminProductOptionListResponse = PaginatedResponse<{
|
|||||||
|
|
||||||
export interface AdminProductOptionDeleteResponse
|
export interface AdminProductOptionDeleteResponse
|
||||||
extends DeleteResponse<"product_option", AdminProduct> {}
|
extends DeleteResponse<"product_option", AdminProduct> {}
|
||||||
|
|
||||||
|
export type AdminProductVariantInventoryResponse = AdminProductVariantInventoryLink | AdminProductVariantInventoryLink[]
|
||||||
|
|
||||||
|
export interface AdminProductVariantInventoryBatchResponse {
|
||||||
|
created: AdminProductVariantInventoryResponse
|
||||||
|
updated: AdminProductVariantInventoryResponse
|
||||||
|
deleted: AdminProductVariantInventoryResponse
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AdminProductVariantInventoryLinkDeleteResponse {
|
||||||
|
id: AdminProductVariantInventoryLink
|
||||||
|
object: "variant-inventory-item-link"
|
||||||
|
deleted: boolean
|
||||||
|
parent: AdminProductVariant
|
||||||
|
}
|
||||||
@@ -5,7 +5,7 @@ import {
|
|||||||
} from "../../../../../../types/routing"
|
} from "../../../../../../types/routing"
|
||||||
import { listPrices } from "../../../queries"
|
import { listPrices } from "../../../queries"
|
||||||
import { adminPriceListPriceRemoteQueryFields } from "../../../query-config"
|
import { adminPriceListPriceRemoteQueryFields } from "../../../query-config"
|
||||||
import { BatchMethodRequest } from "@medusajs/types"
|
import { BatchMethodRequest, HttpTypes } from "@medusajs/types"
|
||||||
import {
|
import {
|
||||||
AdminCreatePriceListPriceType,
|
AdminCreatePriceListPriceType,
|
||||||
AdminUpdatePriceListPriceType,
|
AdminUpdatePriceListPriceType,
|
||||||
@@ -19,7 +19,7 @@ export const POST = async (
|
|||||||
AdminUpdatePriceListPriceType
|
AdminUpdatePriceListPriceType
|
||||||
>
|
>
|
||||||
>,
|
>,
|
||||||
res: MedusaResponse
|
res: MedusaResponse<HttpTypes.AdminPriceListBatchResponse>
|
||||||
) => {
|
) => {
|
||||||
const id = req.params.id
|
const id = req.params.id
|
||||||
const {
|
const {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { batchPriceListPricesWorkflow } from "@medusajs/core-flows"
|
import { batchPriceListPricesWorkflow } from "@medusajs/core-flows"
|
||||||
import { LinkMethodRequest } from "@medusajs/types"
|
import { HttpTypes, LinkMethodRequest } from "@medusajs/types"
|
||||||
import { MedusaError } from "@medusajs/utils"
|
import { MedusaError } from "@medusajs/utils"
|
||||||
import {
|
import {
|
||||||
AuthenticatedMedusaRequest,
|
AuthenticatedMedusaRequest,
|
||||||
@@ -9,7 +9,7 @@ import { fetchPriceList, fetchPriceListPriceIdsForProduct } from "../../helpers"
|
|||||||
|
|
||||||
export const POST = async (
|
export const POST = async (
|
||||||
req: AuthenticatedMedusaRequest<LinkMethodRequest>,
|
req: AuthenticatedMedusaRequest<LinkMethodRequest>,
|
||||||
res: MedusaResponse
|
res: MedusaResponse<HttpTypes.AdminPriceListResponse>
|
||||||
) => {
|
) => {
|
||||||
const id = req.params.id
|
const id = req.params.id
|
||||||
const { add, remove = [] } = req.validatedBody
|
const { add, remove = [] } = req.validatedBody
|
||||||
|
|||||||
@@ -8,10 +8,11 @@ import {
|
|||||||
} from "../../../../types/routing"
|
} from "../../../../types/routing"
|
||||||
import { fetchPriceList } from "../helpers"
|
import { fetchPriceList } from "../helpers"
|
||||||
import { AdminUpdatePriceListType } from "../validators"
|
import { AdminUpdatePriceListType } from "../validators"
|
||||||
|
import { HttpTypes } from "@medusajs/types"
|
||||||
|
|
||||||
export const GET = async (
|
export const GET = async (
|
||||||
req: AuthenticatedMedusaRequest,
|
req: AuthenticatedMedusaRequest,
|
||||||
res: MedusaResponse
|
res: MedusaResponse<HttpTypes.AdminPriceListResponse>
|
||||||
) => {
|
) => {
|
||||||
const price_list = await fetchPriceList(
|
const price_list = await fetchPriceList(
|
||||||
req.params.id,
|
req.params.id,
|
||||||
@@ -24,7 +25,7 @@ export const GET = async (
|
|||||||
|
|
||||||
export const POST = async (
|
export const POST = async (
|
||||||
req: AuthenticatedMedusaRequest<AdminUpdatePriceListType>,
|
req: AuthenticatedMedusaRequest<AdminUpdatePriceListType>,
|
||||||
res: MedusaResponse
|
res: MedusaResponse<HttpTypes.AdminPriceListResponse>
|
||||||
) => {
|
) => {
|
||||||
const id = req.params.id
|
const id = req.params.id
|
||||||
const workflow = updatePriceListsWorkflow(req.scope)
|
const workflow = updatePriceListsWorkflow(req.scope)
|
||||||
@@ -44,7 +45,7 @@ export const POST = async (
|
|||||||
|
|
||||||
export const DELETE = async (
|
export const DELETE = async (
|
||||||
req: AuthenticatedMedusaRequest,
|
req: AuthenticatedMedusaRequest,
|
||||||
res: MedusaResponse
|
res: MedusaResponse<HttpTypes.AdminPriceListDeleteResponse>
|
||||||
) => {
|
) => {
|
||||||
const id = req.params.id
|
const id = req.params.id
|
||||||
const workflow = deletePriceListsWorkflow(req.scope)
|
const workflow = deletePriceListsWorkflow(req.scope)
|
||||||
|
|||||||
@@ -9,10 +9,11 @@ import {
|
|||||||
} from "../../../types/routing"
|
} from "../../../types/routing"
|
||||||
import { fetchPriceList, transformPriceList } from "./helpers"
|
import { fetchPriceList, transformPriceList } from "./helpers"
|
||||||
import { AdminCreatePriceListType } from "./validators"
|
import { AdminCreatePriceListType } from "./validators"
|
||||||
|
import { HttpTypes } from "@medusajs/types"
|
||||||
|
|
||||||
export const GET = async (
|
export const GET = async (
|
||||||
req: AuthenticatedMedusaRequest,
|
req: AuthenticatedMedusaRequest,
|
||||||
res: MedusaResponse
|
res: MedusaResponse<HttpTypes.AdminPriceListListResponse>
|
||||||
) => {
|
) => {
|
||||||
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
|
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
|
||||||
|
|
||||||
@@ -37,7 +38,7 @@ export const GET = async (
|
|||||||
|
|
||||||
export const POST = async (
|
export const POST = async (
|
||||||
req: AuthenticatedMedusaRequest<AdminCreatePriceListType>,
|
req: AuthenticatedMedusaRequest<AdminCreatePriceListType>,
|
||||||
res: MedusaResponse
|
res: MedusaResponse<HttpTypes.AdminPriceListResponse>
|
||||||
) => {
|
) => {
|
||||||
const workflow = createPriceListsWorkflow(req.scope)
|
const workflow = createPriceListsWorkflow(req.scope)
|
||||||
const { result } = await workflow.run({
|
const { result } = await workflow.run({
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import { refetchEntity } from "../../../utils/refetch-entity"
|
|||||||
|
|
||||||
export const GET = async (
|
export const GET = async (
|
||||||
req: AuthenticatedMedusaRequest,
|
req: AuthenticatedMedusaRequest,
|
||||||
res: MedusaResponse
|
res: MedusaResponse<HttpTypes.AdminPricePreferenceResponse>
|
||||||
) => {
|
) => {
|
||||||
const price_preference = await refetchEntity(
|
const price_preference = await refetchEntity(
|
||||||
"price_preference",
|
"price_preference",
|
||||||
@@ -26,7 +26,7 @@ export const GET = async (
|
|||||||
|
|
||||||
export const POST = async (
|
export const POST = async (
|
||||||
req: AuthenticatedMedusaRequest<HttpTypes.AdminUpdatePricePreference>,
|
req: AuthenticatedMedusaRequest<HttpTypes.AdminUpdatePricePreference>,
|
||||||
res: MedusaResponse
|
res: MedusaResponse<HttpTypes.AdminPricePreferenceResponse>
|
||||||
) => {
|
) => {
|
||||||
const id = req.params.id
|
const id = req.params.id
|
||||||
const workflow = updatePricePreferencesWorkflow(req.scope)
|
const workflow = updatePricePreferencesWorkflow(req.scope)
|
||||||
@@ -47,7 +47,7 @@ export const POST = async (
|
|||||||
|
|
||||||
export const DELETE = async (
|
export const DELETE = async (
|
||||||
req: AuthenticatedMedusaRequest,
|
req: AuthenticatedMedusaRequest,
|
||||||
res: MedusaResponse
|
res: MedusaResponse<HttpTypes.AdminPricePreferenceDeleteResponse>
|
||||||
) => {
|
) => {
|
||||||
const id = req.params.id
|
const id = req.params.id
|
||||||
const workflow = deletePricePreferencesWorkflow(req.scope)
|
const workflow = deletePricePreferencesWorkflow(req.scope)
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { createPricePreferencesWorkflow } from "@medusajs/core-flows"
|
|||||||
|
|
||||||
export const GET = async (
|
export const GET = async (
|
||||||
req: AuthenticatedMedusaRequest,
|
req: AuthenticatedMedusaRequest,
|
||||||
res: MedusaResponse
|
res: MedusaResponse<HttpTypes.AdminPricePreferenceListResponse>
|
||||||
) => {
|
) => {
|
||||||
const { rows: price_preferences, metadata } = await refetchEntities(
|
const { rows: price_preferences, metadata } = await refetchEntities(
|
||||||
"price_preference",
|
"price_preference",
|
||||||
@@ -27,7 +27,7 @@ export const GET = async (
|
|||||||
|
|
||||||
export const POST = async (
|
export const POST = async (
|
||||||
req: AuthenticatedMedusaRequest<HttpTypes.AdminCreatePricePreference>,
|
req: AuthenticatedMedusaRequest<HttpTypes.AdminCreatePricePreference>,
|
||||||
res: MedusaResponse
|
res: MedusaResponse<HttpTypes.AdminPricePreferenceResponse>
|
||||||
) => {
|
) => {
|
||||||
const workflow = createPricePreferencesWorkflow(req.scope)
|
const workflow = createPricePreferencesWorkflow(req.scope)
|
||||||
const { result } = await workflow.run({
|
const { result } = await workflow.run({
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import {
|
|||||||
deleteProductCategoriesWorkflow,
|
deleteProductCategoriesWorkflow,
|
||||||
updateProductCategoriesWorkflow,
|
updateProductCategoriesWorkflow,
|
||||||
} from "@medusajs/core-flows"
|
} from "@medusajs/core-flows"
|
||||||
import { AdminProductCategoryResponse } from "@medusajs/types"
|
import { AdminProductCategoryResponse, HttpTypes } from "@medusajs/types"
|
||||||
import {
|
import {
|
||||||
AuthenticatedMedusaRequest,
|
AuthenticatedMedusaRequest,
|
||||||
MedusaResponse,
|
MedusaResponse,
|
||||||
@@ -57,7 +57,7 @@ export const POST = async (
|
|||||||
|
|
||||||
export const DELETE = async (
|
export const DELETE = async (
|
||||||
req: AuthenticatedMedusaRequest,
|
req: AuthenticatedMedusaRequest,
|
||||||
res: MedusaResponse
|
res: MedusaResponse<HttpTypes.AdminProductCategoryDeleteResponse>
|
||||||
) => {
|
) => {
|
||||||
const id = req.params.id
|
const id = req.params.id
|
||||||
|
|
||||||
|
|||||||
@@ -12,10 +12,11 @@ import {
|
|||||||
AdminUpdateProductTagType,
|
AdminUpdateProductTagType,
|
||||||
} from "../validators"
|
} from "../validators"
|
||||||
import { refetchEntity } from "../../../utils/refetch-entity"
|
import { refetchEntity } from "../../../utils/refetch-entity"
|
||||||
|
import { HttpTypes } from "@medusajs/types"
|
||||||
|
|
||||||
export const GET = async (
|
export const GET = async (
|
||||||
req: AuthenticatedMedusaRequest<AdminGetProductTagParamsType>,
|
req: AuthenticatedMedusaRequest<AdminGetProductTagParamsType>,
|
||||||
res: MedusaResponse
|
res: MedusaResponse<HttpTypes.AdminProductTagResponse>
|
||||||
) => {
|
) => {
|
||||||
const productTag = await refetchEntity(
|
const productTag = await refetchEntity(
|
||||||
"product_tag",
|
"product_tag",
|
||||||
@@ -29,7 +30,7 @@ export const GET = async (
|
|||||||
|
|
||||||
export const POST = async (
|
export const POST = async (
|
||||||
req: AuthenticatedMedusaRequest<AdminUpdateProductTagType>,
|
req: AuthenticatedMedusaRequest<AdminUpdateProductTagType>,
|
||||||
res: MedusaResponse
|
res: MedusaResponse<HttpTypes.AdminProductTagResponse>
|
||||||
) => {
|
) => {
|
||||||
const { result } = await updateProductTagsWorkflow(req.scope).run({
|
const { result } = await updateProductTagsWorkflow(req.scope).run({
|
||||||
input: {
|
input: {
|
||||||
@@ -50,7 +51,7 @@ export const POST = async (
|
|||||||
|
|
||||||
export const DELETE = async (
|
export const DELETE = async (
|
||||||
req: AuthenticatedMedusaRequest,
|
req: AuthenticatedMedusaRequest,
|
||||||
res: MedusaResponse
|
res: MedusaResponse<HttpTypes.AdminProductTagDeleteResponse>
|
||||||
) => {
|
) => {
|
||||||
const id = req.params.id
|
const id = req.params.id
|
||||||
|
|
||||||
|
|||||||
@@ -9,10 +9,11 @@ import {
|
|||||||
AdminGetProductTagsParamsType,
|
AdminGetProductTagsParamsType,
|
||||||
} from "./validators"
|
} from "./validators"
|
||||||
import { refetchEntities, refetchEntity } from "../../utils/refetch-entity"
|
import { refetchEntities, refetchEntity } from "../../utils/refetch-entity"
|
||||||
|
import { HttpTypes } from "@medusajs/types"
|
||||||
|
|
||||||
export const GET = async (
|
export const GET = async (
|
||||||
req: AuthenticatedMedusaRequest<AdminGetProductTagsParamsType>,
|
req: AuthenticatedMedusaRequest<AdminGetProductTagsParamsType>,
|
||||||
res: MedusaResponse
|
res: MedusaResponse<HttpTypes.AdminProductTagListResponse>
|
||||||
) => {
|
) => {
|
||||||
const { rows: product_tags, metadata } = await refetchEntities(
|
const { rows: product_tags, metadata } = await refetchEntities(
|
||||||
"product_tag",
|
"product_tag",
|
||||||
@@ -32,7 +33,7 @@ export const GET = async (
|
|||||||
|
|
||||||
export const POST = async (
|
export const POST = async (
|
||||||
req: AuthenticatedMedusaRequest<AdminCreateProductTagType>,
|
req: AuthenticatedMedusaRequest<AdminCreateProductTagType>,
|
||||||
res: MedusaResponse
|
res: MedusaResponse<HttpTypes.AdminProductTagResponse>
|
||||||
) => {
|
) => {
|
||||||
const input = [req.validatedBody]
|
const input = [req.validatedBody]
|
||||||
|
|
||||||
|
|||||||
@@ -12,10 +12,11 @@ import {
|
|||||||
AdminGetProductTypeParamsType,
|
AdminGetProductTypeParamsType,
|
||||||
AdminUpdateProductTypeType,
|
AdminUpdateProductTypeType,
|
||||||
} from "../validators"
|
} from "../validators"
|
||||||
|
import { HttpTypes } from "@medusajs/types"
|
||||||
|
|
||||||
export const GET = async (
|
export const GET = async (
|
||||||
req: AuthenticatedMedusaRequest<AdminGetProductTypeParamsType>,
|
req: AuthenticatedMedusaRequest<AdminGetProductTypeParamsType>,
|
||||||
res: MedusaResponse
|
res: MedusaResponse<HttpTypes.AdminProductTypeResponse>
|
||||||
) => {
|
) => {
|
||||||
const productType = await refetchProductType(
|
const productType = await refetchProductType(
|
||||||
req.params.id,
|
req.params.id,
|
||||||
@@ -28,7 +29,7 @@ export const GET = async (
|
|||||||
|
|
||||||
export const POST = async (
|
export const POST = async (
|
||||||
req: AuthenticatedMedusaRequest<AdminUpdateProductTypeType>,
|
req: AuthenticatedMedusaRequest<AdminUpdateProductTypeType>,
|
||||||
res: MedusaResponse
|
res: MedusaResponse<HttpTypes.AdminProductTypeResponse>
|
||||||
) => {
|
) => {
|
||||||
const { result } = await updateProductTypesWorkflow(req.scope).run({
|
const { result } = await updateProductTypesWorkflow(req.scope).run({
|
||||||
input: {
|
input: {
|
||||||
@@ -48,7 +49,7 @@ export const POST = async (
|
|||||||
|
|
||||||
export const DELETE = async (
|
export const DELETE = async (
|
||||||
req: AuthenticatedMedusaRequest,
|
req: AuthenticatedMedusaRequest,
|
||||||
res: MedusaResponse
|
res: MedusaResponse<HttpTypes.AdminProductTypeDeleteResponse>
|
||||||
) => {
|
) => {
|
||||||
const id = req.params.id
|
const id = req.params.id
|
||||||
|
|
||||||
|
|||||||
@@ -13,10 +13,11 @@ import {
|
|||||||
AdminCreateProductTypeType,
|
AdminCreateProductTypeType,
|
||||||
AdminGetProductTypesParamsType,
|
AdminGetProductTypesParamsType,
|
||||||
} from "./validators"
|
} from "./validators"
|
||||||
|
import { HttpTypes } from "@medusajs/types"
|
||||||
|
|
||||||
export const GET = async (
|
export const GET = async (
|
||||||
req: AuthenticatedMedusaRequest<AdminGetProductTypesParamsType>,
|
req: AuthenticatedMedusaRequest<AdminGetProductTypesParamsType>,
|
||||||
res: MedusaResponse
|
res: MedusaResponse<HttpTypes.AdminProductTypeListResponse>
|
||||||
) => {
|
) => {
|
||||||
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
|
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
|
||||||
const queryObject = remoteQueryObjectFromString({
|
const queryObject = remoteQueryObjectFromString({
|
||||||
@@ -40,7 +41,7 @@ export const GET = async (
|
|||||||
|
|
||||||
export const POST = async (
|
export const POST = async (
|
||||||
req: AuthenticatedMedusaRequest<AdminCreateProductTypeType>,
|
req: AuthenticatedMedusaRequest<AdminCreateProductTypeType>,
|
||||||
res: MedusaResponse
|
res: MedusaResponse<HttpTypes.AdminProductTypeResponse>
|
||||||
) => {
|
) => {
|
||||||
const input = [req.validatedBody]
|
const input = [req.validatedBody]
|
||||||
|
|
||||||
|
|||||||
+4
-3
@@ -6,10 +6,11 @@ import {
|
|||||||
} from "../../../../../../../../types/routing"
|
} from "../../../../../../../../types/routing"
|
||||||
import { refetchVariant } from "../../../../../helpers"
|
import { refetchVariant } from "../../../../../helpers"
|
||||||
import { AdminUpdateVariantInventoryItemType } from "../../../../../validators"
|
import { AdminUpdateVariantInventoryItemType } from "../../../../../validators"
|
||||||
|
import { HttpTypes } from "@medusajs/types"
|
||||||
|
|
||||||
export const POST = async (
|
export const POST = async (
|
||||||
req: AuthenticatedMedusaRequest<AdminUpdateVariantInventoryItemType>,
|
req: AuthenticatedMedusaRequest<AdminUpdateVariantInventoryItemType>,
|
||||||
res: MedusaResponse
|
res: MedusaResponse<HttpTypes.AdminProductVariantResponse>
|
||||||
) => {
|
) => {
|
||||||
const variantId = req.params.variant_id
|
const variantId = req.params.variant_id
|
||||||
const inventoryItemId = req.params.inventory_item_id
|
const inventoryItemId = req.params.inventory_item_id
|
||||||
@@ -35,7 +36,7 @@ export const POST = async (
|
|||||||
|
|
||||||
export const DELETE = async (
|
export const DELETE = async (
|
||||||
req: AuthenticatedMedusaRequest,
|
req: AuthenticatedMedusaRequest,
|
||||||
res: MedusaResponse
|
res: MedusaResponse<HttpTypes.AdminProductVariantInventoryLinkDeleteResponse>
|
||||||
) => {
|
) => {
|
||||||
const variantId = req.params.variant_id
|
const variantId = req.params.variant_id
|
||||||
const inventoryItemId = req.params.inventory_item_id
|
const inventoryItemId = req.params.inventory_item_id
|
||||||
@@ -58,7 +59,7 @@ export const DELETE = async (
|
|||||||
)
|
)
|
||||||
|
|
||||||
res.status(200).json({
|
res.status(200).json({
|
||||||
id: deleted,
|
id: deleted as unknown as HttpTypes.AdminProductVariantInventoryLink,
|
||||||
object: "variant-inventory-item-link",
|
object: "variant-inventory-item-link",
|
||||||
deleted: true,
|
deleted: true,
|
||||||
parent,
|
parent,
|
||||||
|
|||||||
+2
-1
@@ -6,10 +6,11 @@ import {
|
|||||||
} from "../../../../../../../types/routing"
|
} from "../../../../../../../types/routing"
|
||||||
import { refetchVariant } from "../../../../helpers"
|
import { refetchVariant } from "../../../../helpers"
|
||||||
import { AdminCreateVariantInventoryItemType } from "../../../../validators"
|
import { AdminCreateVariantInventoryItemType } from "../../../../validators"
|
||||||
|
import { HttpTypes } from "@medusajs/types"
|
||||||
|
|
||||||
export const POST = async (
|
export const POST = async (
|
||||||
req: AuthenticatedMedusaRequest<AdminCreateVariantInventoryItemType>,
|
req: AuthenticatedMedusaRequest<AdminCreateVariantInventoryItemType>,
|
||||||
res: MedusaResponse
|
res: MedusaResponse<HttpTypes.AdminProductVariantResponse>
|
||||||
) => {
|
) => {
|
||||||
const variantId = req.params.variant_id
|
const variantId = req.params.variant_id
|
||||||
|
|
||||||
|
|||||||
@@ -5,10 +5,11 @@ import {
|
|||||||
} from "../../../../../../../types/routing"
|
} from "../../../../../../../types/routing"
|
||||||
import { buildBatchVariantInventoryData } from "../../../../helpers"
|
import { buildBatchVariantInventoryData } from "../../../../helpers"
|
||||||
import { AdminBatchVariantInventoryItemsType } from "../../../../validators"
|
import { AdminBatchVariantInventoryItemsType } from "../../../../validators"
|
||||||
|
import { HttpTypes } from "@medusajs/types"
|
||||||
|
|
||||||
export const POST = async (
|
export const POST = async (
|
||||||
req: AuthenticatedMedusaRequest<AdminBatchVariantInventoryItemsType>,
|
req: AuthenticatedMedusaRequest<AdminBatchVariantInventoryItemsType>,
|
||||||
res: MedusaResponse
|
res: MedusaResponse<HttpTypes.AdminProductVariantInventoryBatchResponse>
|
||||||
) => {
|
) => {
|
||||||
const { create = [], update = [], delete: toDelete = [] } = req.validatedBody
|
const { create = [], update = [], delete: toDelete = [] } = req.validatedBody
|
||||||
|
|
||||||
@@ -24,5 +25,5 @@ export const POST = async (
|
|||||||
created: result.created,
|
created: result.created,
|
||||||
updated: result.updated,
|
updated: result.updated,
|
||||||
deleted: result.deleted,
|
deleted: result.deleted,
|
||||||
})
|
} as unknown as HttpTypes.AdminProductVariantInventoryBatchResponse)
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user