From 3533aa86e889843c5615f7aef03d0cdef3887486 Mon Sep 17 00:00:00 2001 From: Shahed Nasser Date: Wed, 25 Sep 2024 18:24:23 +0300 Subject: [PATCH] fix(types, medusa): fixes to HTTP types (#9273) ### types - Remove `is_internal` and `is_active` from `StoreProductCategory` - Add missing status, reference, and action enums from `BaseOrderChange` and `BaseOrderChangeAction` - Remove unused totals from `BaseOrderSummary`. - Fix references to base types from admin / store types - Other general fixes ### medusa - Use HTTP types for create / update return reason routes - Remove type arguments from the calculate taxes route since it's a `POST` API route but the type argument for the select query parameters only. - Add `metadata` to the list of cart's fields. - Add type casting for order previews in response --- .../types/src/http/cart/store/entities.ts | 18 ++++- .../types/src/http/claim/admin/entities.ts | 8 ++- .../types/src/http/claim/admin/responses.ts | 7 +- .../src/http/exchange/admin/responses.ts | 7 +- .../src/http/order-edit/admin/responses.ts | 6 +- .../types/src/http/order/admin/entities.ts | 38 +++++++--- .../types/src/http/order/admin/responses.ts | 5 +- packages/core/types/src/http/order/common.ts | 69 +++++-------------- .../types/src/http/order/store/entities.ts | 25 ++++++- .../types/src/http/payment/admin/entities.ts | 16 ++++- .../types/src/http/payment/store/entities.ts | 9 ++- .../http/product-category/store/entities.ts | 7 +- .../types/src/http/product/admin/entitites.ts | 15 +++- .../types/src/http/product/store/entitites.ts | 23 +++++-- .../src/http/promotion/admin/entities.ts | 11 ++- .../src/http/return-reason/admin/payloads.ts | 15 ++-- .../types/src/http/return/admin/entities.ts | 4 +- .../types/src/http/return/store/entities.ts | 7 +- packages/core/types/src/order/common.ts | 9 ++- packages/core/types/src/payment/common.ts | 2 +- .../[id]/claim-items/[action_id]/route.ts | 4 +- .../admin/claims/[id]/claim-items/route.ts | 2 +- .../[id]/inbound/items/[action_id]/route.ts | 4 +- .../admin/claims/[id]/inbound/items/route.ts | 2 +- .../shipping-method/[action_id]/route.ts | 4 +- .../[id]/inbound/shipping-method/route.ts | 2 +- .../[id]/outbound/items/[action_id]/route.ts | 4 +- .../admin/claims/[id]/outbound/items/route.ts | 2 +- .../shipping-method/[action_id]/route.ts | 4 +- .../[id]/outbound/shipping-method/route.ts | 2 +- .../api/admin/claims/[id]/request/route.ts | 2 +- .../[id]/inbound/items/[action_id]/route.ts | 4 +- .../exchanges/[id]/inbound/items/route.ts | 2 +- .../shipping-method/[action_id]/route.ts | 6 +- .../[id]/inbound/shipping-method/route.ts | 2 +- .../[id]/outbound/items/[action_id]/route.ts | 4 +- .../exchanges/[id]/outbound/items/route.ts | 2 +- .../shipping-method/[action_id]/route.ts | 4 +- .../[id]/outbound/shipping-method/route.ts | 2 +- .../api/admin/exchanges/[id]/request/route.ts | 2 +- .../admin/order-edits/[id]/confirm/route.ts | 2 +- .../[id]/items/[action_id]/route.ts | 4 +- .../[id]/items/item/[item_id]/route.ts | 2 +- .../api/admin/order-edits/[id]/items/route.ts | 2 +- .../admin/order-edits/[id]/request/route.ts | 2 +- .../[id]/shipping-method/[action_id]/route.ts | 4 +- .../order-edits/[id]/shipping-method/route.ts | 2 +- .../medusa/src/api/admin/order-edits/route.ts | 2 +- .../api/admin/return-reasons/[id]/route.ts | 8 +-- .../src/api/admin/return-reasons/route.ts | 4 +- .../src/api/store/carts/[id]/taxes/route.ts | 3 +- .../src/api/store/carts/query-config.ts | 1 + 52 files changed, 236 insertions(+), 161 deletions(-) diff --git a/packages/core/types/src/http/cart/store/entities.ts b/packages/core/types/src/http/cart/store/entities.ts index 45152338b0..d2c8b705e5 100644 --- a/packages/core/types/src/http/cart/store/entities.ts +++ b/packages/core/types/src/http/cart/store/entities.ts @@ -1,3 +1,6 @@ +import { StorePaymentCollection } from "../../payment" +import { StoreProduct, StoreProductVariant } from "../../product" +import { StoreRegion } from "../../region" import { BaseCart, BaseCartAddress, @@ -5,7 +8,18 @@ import { BaseCartShippingMethod, } from "../common" -export interface StoreCart extends BaseCart {} -export interface StoreCartLineItem extends BaseCartLineItem {} +export interface StoreCart extends Omit { + shipping_address?: StoreCartAddress + billing_address?: StoreCartAddress + items?: StoreCartLineItem[] + shipping_methods?: StoreCartShippingMethod[] + payment_collection?: StorePaymentCollection + region?: StoreRegion +} +export interface StoreCartLineItem extends Omit { + product?: StoreProduct + variant?: StoreProductVariant + cart: StoreCart +} export interface StoreCartAddress extends BaseCartAddress {} export interface StoreCartShippingMethod extends BaseCartShippingMethod {} \ No newline at end of file diff --git a/packages/core/types/src/http/claim/admin/entities.ts b/packages/core/types/src/http/claim/admin/entities.ts index 92f10998a8..6369bd0692 100644 --- a/packages/core/types/src/http/claim/admin/entities.ts +++ b/packages/core/types/src/http/claim/admin/entities.ts @@ -1,3 +1,9 @@ +import { AdminOrder, AdminOrderShippingMethod } from "../../order" +import { AdminReturn } from "../../return" import { BaseClaim } from "../common" -export interface AdminClaim extends BaseClaim {} +export interface AdminClaim extends BaseClaim { + order: AdminOrder + return: AdminReturn + shipping_methods?: AdminOrderShippingMethod[] +} diff --git a/packages/core/types/src/http/claim/admin/responses.ts b/packages/core/types/src/http/claim/admin/responses.ts index 5adad75790..f974b8b27c 100644 --- a/packages/core/types/src/http/claim/admin/responses.ts +++ b/packages/core/types/src/http/claim/admin/responses.ts @@ -1,5 +1,6 @@ -import { OrderDTO, OrderPreviewDTO } from "../../../order" +import { OrderDTO } from "../../../order" import { DeleteResponse, PaginatedResponse } from "../../common" +import { AdminOrderPreview } from "../../order" import { AdminReturn } from "../../return" import { AdminClaim } from "./entities" @@ -18,12 +19,12 @@ export interface AdminClaimOrderResponse { } export interface AdminClaimPreviewResponse { - order_preview: OrderPreviewDTO + order_preview: AdminOrderPreview claim: AdminClaim } export interface AdminClaimReturnPreviewResponse { - order_preview: OrderPreviewDTO + order_preview: AdminOrderPreview return: AdminReturn } diff --git a/packages/core/types/src/http/exchange/admin/responses.ts b/packages/core/types/src/http/exchange/admin/responses.ts index c0e82be33f..0343a63989 100644 --- a/packages/core/types/src/http/exchange/admin/responses.ts +++ b/packages/core/types/src/http/exchange/admin/responses.ts @@ -1,5 +1,6 @@ -import { OrderDTO, OrderPreviewDTO } from "../../../order" +import { OrderDTO } from "../../../order" import { DeleteResponse, PaginatedResponse } from "../../common" +import { AdminOrderPreview } from "../../order" import { AdminReturn } from "../../return" import { AdminExchange } from "./entities" @@ -17,7 +18,7 @@ export interface AdminExchangeOrderResponse { } export interface AdminExchangePreviewResponse { - order_preview: OrderPreviewDTO + order_preview: AdminOrderPreview exchange: AdminExchange } @@ -27,7 +28,7 @@ export interface AdminExchangeRequestResponse } export interface AdminExchangeReturnResponse { - order_preview: OrderPreviewDTO + order_preview: AdminOrderPreview return: AdminReturn } diff --git a/packages/core/types/src/http/order-edit/admin/responses.ts b/packages/core/types/src/http/order-edit/admin/responses.ts index aa47795d35..5119cd2e71 100644 --- a/packages/core/types/src/http/order-edit/admin/responses.ts +++ b/packages/core/types/src/http/order-edit/admin/responses.ts @@ -1,12 +1,12 @@ -import { OrderChangeDTO, OrderPreviewDTO } from "../../../order" import { DeleteResponse } from "../../common" +import { AdminOrderChange, AdminOrderPreview } from "../../order/admin" export interface AdminOrderEditPreviewResponse { - order_preview: OrderPreviewDTO + order_preview: AdminOrderPreview } export interface AdminOrderEditResponse { - order_change: OrderChangeDTO + order_change: AdminOrderChange } export type AdminOrderEditDeleteResponse = DeleteResponse<"order-edit"> diff --git a/packages/core/types/src/http/order/admin/entities.ts b/packages/core/types/src/http/order/admin/entities.ts index 3c19c87510..1b25ad988a 100644 --- a/packages/core/types/src/http/order/admin/entities.ts +++ b/packages/core/types/src/http/order/admin/entities.ts @@ -1,7 +1,10 @@ +import { AdminClaim } from "../../claim" import { AdminCustomer } from "../../customer" +import { AdminExchange } from "../../exchange" import { AdminPaymentCollection } from "../../payment/admin" -import { AdminProductVariant } from "../../product" +import { AdminProduct, AdminProductVariant } from "../../product" import { AdminRegionCountry } from "../../region" +import { AdminReturn } from "../../return" import { AdminSalesChannel } from "../../sales-channel" import { BaseOrder, @@ -13,24 +16,37 @@ import { BaseOrderShippingMethod, } from "../common" -export interface AdminOrder extends BaseOrder { +export interface AdminOrder extends Omit { payment_collections: AdminPaymentCollection[] - fulfillments?: BaseOrderFulfillment[] + fulfillments?: AdminOrderFulfillment[] sales_channel?: AdminSalesChannel customer?: AdminCustomer shipping_address?: AdminOrderAddress | null billing_address?: AdminOrderAddress | null items: AdminOrderLineItem[] + shipping_methods: AdminOrderShippingMethod[] } -export interface AdminOrderLineItem extends BaseOrderLineItem { - variant?: AdminProductVariant +export interface AdminOrderChange extends + Omit { + order: AdminOrder + claim: AdminClaim + return_order: AdminReturn + exchange: AdminExchange + actions: AdminOrderChangeAction[] +} + +export interface AdminOrderChangeAction extends Omit { + order_change: AdminOrderChange + order: AdminOrder | null } -export interface AdminOrderChange extends BaseOrderChange {} export interface AdminOrderFulfillment extends BaseOrderFulfillment {} -export interface AdminOrderLineItem extends BaseOrderLineItem {} +export interface AdminOrderLineItem extends Omit { + variant?: AdminProductVariant + product?: AdminProduct +} export interface AdminOrderAddress extends BaseOrderAddress { country?: AdminRegionCountry @@ -41,9 +57,9 @@ export interface AdminOrderShippingMethod extends BaseOrderShippingMethod {} export interface AdminOrderPreview extends Omit { return_requested_total: number - order_change: BaseOrderChange - items: (BaseOrderLineItem & { actions?: BaseOrderChangeAction[] })[] - shipping_methods: (BaseOrderShippingMethod & { - actions?: BaseOrderChangeAction[] + order_change: AdminOrderChange + items: (AdminOrderLineItem & { actions?: AdminOrderChangeAction[] })[] + shipping_methods: (AdminOrderShippingMethod & { + actions?: AdminOrderChangeAction[] })[] } diff --git a/packages/core/types/src/http/order/admin/responses.ts b/packages/core/types/src/http/order/admin/responses.ts index 96bf872b6d..7289276ee9 100644 --- a/packages/core/types/src/http/order/admin/responses.ts +++ b/packages/core/types/src/http/order/admin/responses.ts @@ -1,13 +1,12 @@ import { PaginatedResponse } from "../../common" -import { BaseOrderChange } from "../common" -import { AdminOrder, AdminOrderPreview } from "./entities" +import { AdminOrder, AdminOrderChange, AdminOrderPreview } from "./entities" export interface AdminOrderResponse { order: AdminOrder } export interface AdminOrderChangesResponse { - order_changes: BaseOrderChange[] + order_changes: AdminOrderChange[] } export type AdminOrderListResponse = PaginatedResponse<{ diff --git a/packages/core/types/src/http/order/common.ts b/packages/core/types/src/http/order/common.ts index 0275d2642a..a3b6cb9a48 100644 --- a/packages/core/types/src/http/order/common.ts +++ b/packages/core/types/src/http/order/common.ts @@ -1,8 +1,11 @@ import { BaseFilterable, OperatorMap } from "../../dal" +import { ChangeActionType, OrderChangeStatus } from "../../order" import { BaseClaim } from "../claim/common" import { FindParams } from "../common" +import { BaseExchange } from "../exchange/common" import { BasePaymentCollection } from "../payment/common" import { BaseProduct, BaseProductVariant } from "../product/common" +import { BaseReturn } from "../return/common" export interface BaseOrderSummary { total: number @@ -13,11 +16,6 @@ export interface BaseOrderSummary { returned_total: number return_request_total: number write_off_total: number - projected_total: number - net_total: number - net_subtotal: number - net_total_tax: number - balance: number paid_total: number refunded_total: number } @@ -180,52 +178,19 @@ export interface BaseOrderShippingDetail { id: string shipping_method_id: string shipping_method: BaseOrderShippingMethod - claim_id: string - exchange_id: string - return_id: string + claim_id?: string + exchange_id?: string + return_id?: string created_at: Date updated_at: Date } -export interface BaseOrderChange { - id: string - order_id: string - actions: BaseOrderChangeAction[] - status: string - requested_by: string | null - requested_at: Date | string | null - confirmed_by: string | null - confirmed_at: Date | string | null - declined_by: string | null - declined_reason: string | null - metadata: Record | null - declined_at: Date | string | null - canceled_by: string | null - canceled_at: Date | string | null - created_at: Date | string - updated_at: Date | string -} - -export interface BaseOrderChangeAction { - id: string - order_change_id: string | null - order_change: BaseOrderChange | null - order_id: string | null - reference: string - reference_id: string - action: string - details: Record | null - internal_note: string | null - created_at: Date | string - updated_at: Date | string -} - export interface BaseOrderTransaction { id: string order_id: string amount: number currency_code: string - reference: string + reference: "capture" | "refund" reference_id: string metadata: Record | null created_at: Date | string @@ -289,7 +254,7 @@ export interface BaseOrder { fulfillment_status: FulfillmentStatus transactions?: BaseOrderTransaction[] summary: BaseOrderSummary - metadata: Record | null + metadata?: Record | null created_at: string | Date updated_at: string | Date original_item_total: number @@ -378,14 +343,14 @@ export interface BaseOrderChange { * * @expandable */ - return_order: any + return_order: BaseReturn /** * The associated exchange order * * @expandable */ - exchange: any + exchange: BaseExchange /** * The associated claim order @@ -404,7 +369,7 @@ export interface BaseOrderChange { /** * The status of the order change */ - status: string + status: OrderChangeStatus /** * The requested by of the order change @@ -414,7 +379,7 @@ export interface BaseOrderChange { /** * When the order change was requested */ - requested_at: Date | string | null + requested_at: Date | null /** * The confirmed by of the order change @@ -424,7 +389,7 @@ export interface BaseOrderChange { /** * When the order change was confirmed */ - confirmed_at: Date | string | null + confirmed_at: Date | null /** * The declined by of the order change @@ -444,7 +409,7 @@ export interface BaseOrderChange { /** * When the order change was declined */ - declined_at: Date | string | null + declined_at: Date | null /** * The canceled by of the order change @@ -454,7 +419,7 @@ export interface BaseOrderChange { /** * When the order change was canceled */ - canceled_at: Date | string | null + canceled_at: Date | null /** * When the order change was created @@ -518,7 +483,7 @@ export interface BaseOrderChangeAction { /** * The reference of the order change action */ - reference: string + reference: "claim" | "exchange" | "return" | "order_shipping_method" /** * The ID of the reference @@ -528,7 +493,7 @@ export interface BaseOrderChangeAction { /** * The action of the order change action */ - action: string + action: ChangeActionType /** * The details of the order change action diff --git a/packages/core/types/src/http/order/store/entities.ts b/packages/core/types/src/http/order/store/entities.ts index 10c586da28..fe95b94ff0 100644 --- a/packages/core/types/src/http/order/store/entities.ts +++ b/packages/core/types/src/http/order/store/entities.ts @@ -1,11 +1,30 @@ +import { StoreCustomer } from "../../customer" +import { StorePaymentCollection } from "../../payment" +import { StoreProduct, StoreProductVariant } from "../../product" +import { StoreRegionCountry } from "../../region" import { BaseOrder, BaseOrderAddress, + BaseOrderFulfillment, BaseOrderLineItem, BaseOrderShippingMethod, } from "../common" -export interface StoreOrder extends BaseOrder {} -export interface StoreOrderLineItem extends BaseOrderLineItem {} -export interface StoreOrderAddress extends BaseOrderAddress {} +export interface StoreOrder extends Omit { + shipping_address?: StoreOrderAddress | null + billing_address?: StoreOrderAddress | null + items: StoreOrderLineItem[] | null + shipping_methods: StoreOrderShippingMethod[] | null + payment_collections?: StorePaymentCollection[] + fulfillments?: StoreOrderFulfillment[] + customer?: StoreCustomer +} +export interface StoreOrderLineItem extends Omit { + variant?: StoreProductVariant + product?: StoreProduct +} +export interface StoreOrderAddress extends BaseOrderAddress { + country?: StoreRegionCountry +} export interface StoreOrderShippingMethod extends BaseOrderShippingMethod {} +export interface StoreOrderFulfillment extends BaseOrderFulfillment {} \ No newline at end of file diff --git a/packages/core/types/src/http/payment/admin/entities.ts b/packages/core/types/src/http/payment/admin/entities.ts index 8bce9788e3..5e04b86a24 100644 --- a/packages/core/types/src/http/payment/admin/entities.ts +++ b/packages/core/types/src/http/payment/admin/entities.ts @@ -11,8 +11,18 @@ export interface AdminPaymentProvider extends BasePaymentProvider { is_enabled: boolean } -export interface AdminPayment extends BasePayment {} -export interface AdminPaymentCollection extends BasePaymentCollection {} -export interface AdminPaymentSession extends BasePaymentSession {} +export interface AdminPayment extends BasePayment { + refunds?: AdminRefund[] + payment_collection?: AdminPaymentCollection + payment_session?: AdminPaymentSession +} +export interface AdminPaymentCollection extends BasePaymentCollection { + payments?: AdminPayment[] + payment_sessions?: AdminPaymentSession[] + payment_providers: AdminPaymentProvider[] +} +export interface AdminPaymentSession extends BasePaymentSession { + payment_collection?: AdminPaymentCollection +} export interface AdminRefund extends BaseRefund {} export interface AdminRefundReason extends RefundReason {} \ No newline at end of file diff --git a/packages/core/types/src/http/payment/store/entities.ts b/packages/core/types/src/http/payment/store/entities.ts index 6e40cab856..616be10892 100644 --- a/packages/core/types/src/http/payment/store/entities.ts +++ b/packages/core/types/src/http/payment/store/entities.ts @@ -5,5 +5,10 @@ import { } from "../common" export interface StorePaymentProvider extends BasePaymentProvider {} -export interface StorePaymentCollection extends BasePaymentCollection {} -export interface StorePaymentSession extends BasePaymentSession {} \ No newline at end of file +export interface StorePaymentCollection extends BasePaymentCollection { + payment_sessions?: StorePaymentSession[] + payment_providers: StorePaymentProvider[] +} +export interface StorePaymentSession extends BasePaymentSession { + payment_collection?: StorePaymentCollection +} \ No newline at end of file diff --git a/packages/core/types/src/http/product-category/store/entities.ts b/packages/core/types/src/http/product-category/store/entities.ts index 864ceab344..5b331eb8cc 100644 --- a/packages/core/types/src/http/product-category/store/entities.ts +++ b/packages/core/types/src/http/product-category/store/entities.ts @@ -1,6 +1,9 @@ import { StoreProduct } from "../../product/store" import { BaseProductCategory } from "../common" -export interface StoreProductCategory extends BaseProductCategory { - products?: StoreProduct[] +export interface StoreProductCategory extends + Omit { + products?: StoreProduct[] + parent_category: StoreProductCategory | null + category_children: StoreProductCategory[] } diff --git a/packages/core/types/src/http/product/admin/entitites.ts b/packages/core/types/src/http/product/admin/entitites.ts index 3f480bb09d..0ce4bd160a 100644 --- a/packages/core/types/src/http/product/admin/entitites.ts +++ b/packages/core/types/src/http/product/admin/entitites.ts @@ -15,18 +15,27 @@ import { export interface AdminProductVariant extends BaseProductVariant { prices: AdminPrice[] | null + options: AdminProductOptionValue[] | null + product?: AdminProduct | null +} +export interface AdminProductOption extends BaseProductOption { + product?: AdminProduct | null + values?: AdminProductOptionValue[] } -export interface AdminProductOption extends BaseProductOption {} export interface AdminProductImage extends BaseProductImage {} -export interface AdminProductOptionValue extends BaseProductOptionValue {} +export interface AdminProductOptionValue extends BaseProductOptionValue { + option?: AdminProductOption | null +} export interface AdminProduct extends Omit { collection?: AdminCollection | null categories?: AdminProductCategory[] | null sales_channels?: AdminSalesChannel[] | null - variants?: AdminProductVariant[] | null + variants: AdminProductVariant[] | null type: AdminProductType | null tags?: AdminProductTag[] | null + options: AdminProductOption[] | null + images: AdminProductImage[] | null } export type AdminProductStatus = ProductStatus export interface AdminProductVariantInventoryLink { diff --git a/packages/core/types/src/http/product/store/entitites.ts b/packages/core/types/src/http/product/store/entitites.ts index 0ba2f3f1bf..918a3c0417 100644 --- a/packages/core/types/src/http/product/store/entitites.ts +++ b/packages/core/types/src/http/product/store/entitites.ts @@ -1,4 +1,6 @@ +import { StoreCollection } from "../../collection" import { StoreProductCategory } from "../../product-category" +import { StoreProductTag } from "../../product-tag" import { StoreProductType } from "../../product-type" import { BaseProduct, @@ -9,12 +11,25 @@ import { ProductStatus, } from "../common" -export interface StoreProduct extends Omit { +export interface StoreProduct extends Omit { + collection?: StoreCollection | null categories?: StoreProductCategory[] | null + variants: StoreProductVariant[] | null type?: StoreProductType | null + tags?: StoreProductTag[] | null + options: StoreProductOption[] | null + images: StoreProductImage[] | null +} +export interface StoreProductVariant extends Omit { + options: StoreProductOptionValue[] | null + product?: StoreProduct | null +} +export interface StoreProductOption extends Omit { + product?: StoreProduct | null + values?: StoreProductOptionValue[] } -export interface StoreProductVariant extends BaseProductVariant {} -export interface StoreProductOption extends BaseProductOption {} export interface StoreProductImage extends BaseProductImage {} -export interface StoreProductOptionValue extends BaseProductOptionValue {} +export interface StoreProductOptionValue extends Omit { + option?: StoreProductOption | null +} export type StoreProductStatus = ProductStatus diff --git a/packages/core/types/src/http/promotion/admin/entities.ts b/packages/core/types/src/http/promotion/admin/entities.ts index 046f6bb278..13e68e8846 100644 --- a/packages/core/types/src/http/promotion/admin/entities.ts +++ b/packages/core/types/src/http/promotion/admin/entities.ts @@ -1,4 +1,5 @@ import { + BaseApplicationMethod, BasePromotion, BasePromotionRule, BaseRuleAttributeOptions, @@ -6,7 +7,15 @@ import { BaseRuleValueOptions } from "../common"; -export interface AdminPromotion extends BasePromotion {} +export interface AdminPromotion extends BasePromotion { + application_method?: AdminApplicationMethod + rules?: AdminPromotionRule[] +} +export interface AdminApplicationMethod extends BaseApplicationMethod { + promotion?: AdminPromotion + target_rules?: AdminPromotionRule[] + buy_rules?: AdminPromotionRule[] +} export interface AdminPromotionRule extends BasePromotionRule {} export interface AdminRuleAttributeOption extends BaseRuleAttributeOptions {} export interface AdminRuleOperatorOption extends BaseRuleOperatorOptions {} diff --git a/packages/core/types/src/http/return-reason/admin/payloads.ts b/packages/core/types/src/http/return-reason/admin/payloads.ts index 3646c3edc2..c70596b429 100644 --- a/packages/core/types/src/http/return-reason/admin/payloads.ts +++ b/packages/core/types/src/http/return-reason/admin/payloads.ts @@ -1,14 +1,13 @@ -import { AdminReturnReason } from "./entities" - -type AdminBaseReturnReasonPayload = Pick< - AdminReturnReason, - "value" | "label" | "description" -> +type AdminBaseReturnReasonPayload = { + value: string + label: string + description?: string + metadata?: Record | null +} export interface AdminCreateReturnReason extends AdminBaseReturnReasonPayload { - metadata?: Record | null + parent_return_reason_id?: string } export interface AdminUpdateReturnReason extends AdminBaseReturnReasonPayload { - metadata?: Record | null } diff --git a/packages/core/types/src/http/return/admin/entities.ts b/packages/core/types/src/http/return/admin/entities.ts index b0e0189a13..50d3141afa 100644 --- a/packages/core/types/src/http/return/admin/entities.ts +++ b/packages/core/types/src/http/return/admin/entities.ts @@ -1,4 +1,6 @@ import { BaseReturn, BaseReturnItem } from "../common"; export interface AdminReturnItem extends BaseReturnItem {} -export interface AdminReturn extends BaseReturn {} \ No newline at end of file +export interface AdminReturn extends BaseReturn { + items: AdminReturnItem[] +} \ No newline at end of file diff --git a/packages/core/types/src/http/return/store/entities.ts b/packages/core/types/src/http/return/store/entities.ts index b8be7b4a40..ced7961dff 100644 --- a/packages/core/types/src/http/return/store/entities.ts +++ b/packages/core/types/src/http/return/store/entities.ts @@ -1,3 +1,6 @@ -import { BaseReturn } from "../common"; +import { BaseReturn, BaseReturnItem } from "../common"; -export interface StoreReturn extends BaseReturn {} +export interface StoreReturn extends BaseReturn { + items: StoreReturnItem[] +} +export interface StoreReturnItem extends BaseReturnItem {} diff --git a/packages/core/types/src/order/common.ts b/packages/core/types/src/order/common.ts index 17af49c3a6..715b5684ce 100644 --- a/packages/core/types/src/order/common.ts +++ b/packages/core/types/src/order/common.ts @@ -25,6 +25,8 @@ export type ChangeActionType = | "WRITE_OFF_ITEM" | "REINSTATE_ITEM" +export type OrderChangeStatus = "confirmed" | "declined" | "requested" | "pending" | "canceled" + /** * @interface * @@ -1093,12 +1095,12 @@ export interface OrderDTO { /** * When the order was created. */ - created_at?: string | Date + created_at: string | Date /** * When the order was updated. */ - updated_at?: string | Date + updated_at: string | Date /** * The original item total of the order. @@ -1801,7 +1803,7 @@ export interface OrderChangeDTO { /** * The status of the order change */ - status: string + status: OrderChangeStatus /** * The requested by of the order change @@ -2699,4 +2701,5 @@ export interface OrderPreviewDTO shipping_methods: (OrderShippingMethodDTO & { actions?: OrderChangeActionDTO[] })[] + return_requested_total: number } diff --git a/packages/core/types/src/payment/common.ts b/packages/core/types/src/payment/common.ts index 59f85aa856..de4043f630 100644 --- a/packages/core/types/src/payment/common.ts +++ b/packages/core/types/src/payment/common.ts @@ -610,7 +610,7 @@ export interface PaymentProviderDTO { /** * Whether the payment provider is enabled. */ - is_enabled: string + is_enabled: boolean } /** diff --git a/packages/medusa/src/api/admin/claims/[id]/claim-items/[action_id]/route.ts b/packages/medusa/src/api/admin/claims/[id]/claim-items/[action_id]/route.ts index 8acffa0ba0..31a3a95b1c 100644 --- a/packages/medusa/src/api/admin/claims/[id]/claim-items/[action_id]/route.ts +++ b/packages/medusa/src/api/admin/claims/[id]/claim-items/[action_id]/route.ts @@ -43,7 +43,7 @@ export const POST = async ( const [orderClaim] = await remoteQuery(queryObject) res.json({ - order_preview: result, + order_preview: result as unknown as HttpTypes.AdminOrderPreview, claim: orderClaim, }) } @@ -78,7 +78,7 @@ export const DELETE = async ( const [orderClaim] = await remoteQuery(queryObject) res.json({ - order_preview: orderPreview, + order_preview: orderPreview as unknown as HttpTypes.AdminOrderPreview, claim: orderClaim, }) } diff --git a/packages/medusa/src/api/admin/claims/[id]/claim-items/route.ts b/packages/medusa/src/api/admin/claims/[id]/claim-items/route.ts index d022e6e6b7..4b6f2431f8 100644 --- a/packages/medusa/src/api/admin/claims/[id]/claim-items/route.ts +++ b/packages/medusa/src/api/admin/claims/[id]/claim-items/route.ts @@ -36,7 +36,7 @@ export const POST = async ( const [orderClaim] = await remoteQuery(queryObject) res.json({ - order_preview: result, + order_preview: result as unknown as HttpTypes.AdminOrderPreview, claim: orderClaim, }) } diff --git a/packages/medusa/src/api/admin/claims/[id]/inbound/items/[action_id]/route.ts b/packages/medusa/src/api/admin/claims/[id]/inbound/items/[action_id]/route.ts index 43bf8ba1f1..9b5649e05c 100644 --- a/packages/medusa/src/api/admin/claims/[id]/inbound/items/[action_id]/route.ts +++ b/packages/medusa/src/api/admin/claims/[id]/inbound/items/[action_id]/route.ts @@ -56,7 +56,7 @@ export const POST = async ( const [orderReturn] = await remoteQuery(queryObject) res.json({ - order_preview: result, + order_preview: result as unknown as HttpTypes.AdminOrderPreview, return: orderReturn, }) } @@ -89,7 +89,7 @@ export const DELETE = async ( ) res.json({ - order_preview: orderPreview, + order_preview: orderPreview as unknown as HttpTypes.AdminOrderPreview, return: orderReturn, }) } diff --git a/packages/medusa/src/api/admin/claims/[id]/inbound/items/route.ts b/packages/medusa/src/api/admin/claims/[id]/inbound/items/route.ts index ff0833faa0..5f8a245ee1 100644 --- a/packages/medusa/src/api/admin/claims/[id]/inbound/items/route.ts +++ b/packages/medusa/src/api/admin/claims/[id]/inbound/items/route.ts @@ -52,7 +52,7 @@ export const POST = async ( const [orderReturn] = await remoteQuery(queryObject) res.json({ - order_preview: result, + order_preview: result as unknown as HttpTypes.AdminOrderPreview, return: orderReturn, }) } diff --git a/packages/medusa/src/api/admin/claims/[id]/inbound/shipping-method/[action_id]/route.ts b/packages/medusa/src/api/admin/claims/[id]/inbound/shipping-method/[action_id]/route.ts index 5b84a8a438..0c67b81683 100644 --- a/packages/medusa/src/api/admin/claims/[id]/inbound/shipping-method/[action_id]/route.ts +++ b/packages/medusa/src/api/admin/claims/[id]/inbound/shipping-method/[action_id]/route.ts @@ -57,7 +57,7 @@ export const POST = async ( const [orderClaim] = await remoteQuery(queryObject) res.json({ - order_preview: result, + order_preview: result as unknown as HttpTypes.AdminOrderPreview, claim: orderClaim, }) } @@ -103,7 +103,7 @@ export const DELETE = async ( const [orderReturn] = await remoteQuery(queryObject) res.json({ - order_preview: orderPreview, + order_preview: orderPreview as unknown as HttpTypes.AdminOrderPreview, return: orderReturn, }) } diff --git a/packages/medusa/src/api/admin/claims/[id]/inbound/shipping-method/route.ts b/packages/medusa/src/api/admin/claims/[id]/inbound/shipping-method/route.ts index 83abb4dc0d..f4910d460e 100644 --- a/packages/medusa/src/api/admin/claims/[id]/inbound/shipping-method/route.ts +++ b/packages/medusa/src/api/admin/claims/[id]/inbound/shipping-method/route.ts @@ -52,7 +52,7 @@ export const POST = async ( const [orderReturn] = await remoteQuery(queryObject) res.json({ - order_preview: result, + order_preview: result as unknown as HttpTypes.AdminOrderPreview, return: orderReturn, }) } diff --git a/packages/medusa/src/api/admin/claims/[id]/outbound/items/[action_id]/route.ts b/packages/medusa/src/api/admin/claims/[id]/outbound/items/[action_id]/route.ts index 00a0a1491c..fefa484910 100644 --- a/packages/medusa/src/api/admin/claims/[id]/outbound/items/[action_id]/route.ts +++ b/packages/medusa/src/api/admin/claims/[id]/outbound/items/[action_id]/route.ts @@ -43,7 +43,7 @@ export const POST = async ( const [orderClaim] = await remoteQuery(queryObject) res.json({ - order_preview: result, + order_preview: result as unknown as HttpTypes.AdminOrderPreview, claim: orderClaim, }) } @@ -77,7 +77,7 @@ export const DELETE = async ( const [orderClaim] = await remoteQuery(queryObject) res.json({ - order_preview: orderPreview, + order_preview: orderPreview as unknown as HttpTypes.AdminOrderPreview, claim: orderClaim, }) } diff --git a/packages/medusa/src/api/admin/claims/[id]/outbound/items/route.ts b/packages/medusa/src/api/admin/claims/[id]/outbound/items/route.ts index 74c056081a..8239258b40 100644 --- a/packages/medusa/src/api/admin/claims/[id]/outbound/items/route.ts +++ b/packages/medusa/src/api/admin/claims/[id]/outbound/items/route.ts @@ -37,7 +37,7 @@ export const POST = async ( const [orderClaim] = await remoteQuery(queryObject) res.json({ - order_preview: result, + order_preview: result as unknown as HttpTypes.AdminOrderPreview, claim: orderClaim, }) } diff --git a/packages/medusa/src/api/admin/claims/[id]/outbound/shipping-method/[action_id]/route.ts b/packages/medusa/src/api/admin/claims/[id]/outbound/shipping-method/[action_id]/route.ts index 07a4ced3f7..6d960f625e 100644 --- a/packages/medusa/src/api/admin/claims/[id]/outbound/shipping-method/[action_id]/route.ts +++ b/packages/medusa/src/api/admin/claims/[id]/outbound/shipping-method/[action_id]/route.ts @@ -43,7 +43,7 @@ export const POST = async ( const [orderClaim] = await remoteQuery(queryObject) res.json({ - order_preview: result, + order_preview: result as unknown as HttpTypes.AdminOrderPreview, claim: orderClaim, }) } @@ -78,7 +78,7 @@ export const DELETE = async ( const [orderClaim] = await remoteQuery(queryObject) res.json({ - order_preview: orderPreview, + order_preview: orderPreview as unknown as HttpTypes.AdminOrderPreview, claim: orderClaim, }) } diff --git a/packages/medusa/src/api/admin/claims/[id]/outbound/shipping-method/route.ts b/packages/medusa/src/api/admin/claims/[id]/outbound/shipping-method/route.ts index ead573f3bb..a53455d90c 100644 --- a/packages/medusa/src/api/admin/claims/[id]/outbound/shipping-method/route.ts +++ b/packages/medusa/src/api/admin/claims/[id]/outbound/shipping-method/route.ts @@ -36,7 +36,7 @@ export const POST = async ( const [orderClaim] = await remoteQuery(queryObject) res.json({ - order_preview: result, + order_preview: result as unknown as HttpTypes.AdminOrderPreview, claim: orderClaim, }) } diff --git a/packages/medusa/src/api/admin/claims/[id]/request/route.ts b/packages/medusa/src/api/admin/claims/[id]/request/route.ts index df7640c9b0..6b8a69bd79 100644 --- a/packages/medusa/src/api/admin/claims/[id]/request/route.ts +++ b/packages/medusa/src/api/admin/claims/[id]/request/route.ts @@ -58,7 +58,7 @@ export const POST = async ( } res.json({ - order_preview: result, + order_preview: result as unknown as HttpTypes.AdminOrderPreview, claim: orderClaim, return: orderReturn, }) diff --git a/packages/medusa/src/api/admin/exchanges/[id]/inbound/items/[action_id]/route.ts b/packages/medusa/src/api/admin/exchanges/[id]/inbound/items/[action_id]/route.ts index f3605f3332..3aad050126 100644 --- a/packages/medusa/src/api/admin/exchanges/[id]/inbound/items/[action_id]/route.ts +++ b/packages/medusa/src/api/admin/exchanges/[id]/inbound/items/[action_id]/route.ts @@ -56,7 +56,7 @@ export const POST = async ( const [orderReturn] = await remoteQuery(queryObject) res.json({ - order_preview: result, + order_preview: result as unknown as HttpTypes.AdminOrderPreview, return: orderReturn, }) } @@ -93,7 +93,7 @@ export const DELETE = async ( const [orderReturn] = await remoteQuery(queryObject) res.json({ - order_preview: orderPreview, + order_preview: orderPreview as unknown as HttpTypes.AdminOrderPreview, return: orderReturn, }) } diff --git a/packages/medusa/src/api/admin/exchanges/[id]/inbound/items/route.ts b/packages/medusa/src/api/admin/exchanges/[id]/inbound/items/route.ts index 11600c659e..0271229f5f 100644 --- a/packages/medusa/src/api/admin/exchanges/[id]/inbound/items/route.ts +++ b/packages/medusa/src/api/admin/exchanges/[id]/inbound/items/route.ts @@ -54,7 +54,7 @@ export const POST = async ( const [orderReturn] = await remoteQuery(queryObject) res.json({ - order_preview: result, + order_preview: result as unknown as HttpTypes.AdminOrderPreview, return: orderReturn, }) } diff --git a/packages/medusa/src/api/admin/exchanges/[id]/inbound/shipping-method/[action_id]/route.ts b/packages/medusa/src/api/admin/exchanges/[id]/inbound/shipping-method/[action_id]/route.ts index f56abeed24..983d665fc7 100644 --- a/packages/medusa/src/api/admin/exchanges/[id]/inbound/shipping-method/[action_id]/route.ts +++ b/packages/medusa/src/api/admin/exchanges/[id]/inbound/shipping-method/[action_id]/route.ts @@ -12,7 +12,7 @@ import { } from "../../../../../../../types/routing" import { defaultAdminDetailsReturnFields } from "../../../../../returns/query-config" import { AdminPostExchangesShippingActionReqSchemaType } from "../../../../validators" -import { HttpTypes } from "@medusajs/types" +import { AdminOrderPreview, HttpTypes } from "@medusajs/types" export const POST = async ( req: AuthenticatedMedusaRequest, @@ -57,7 +57,7 @@ export const POST = async ( const [orderExchange] = await remoteQuery(queryObject) res.json({ - order_preview: result, + order_preview: result as unknown as AdminOrderPreview, exchange: orderExchange, }) } @@ -103,7 +103,7 @@ export const DELETE = async ( const [orderReturn] = await remoteQuery(queryObject) res.json({ - order_preview: orderPreview, + order_preview: orderPreview as unknown as AdminOrderPreview, return: orderReturn, }) } diff --git a/packages/medusa/src/api/admin/exchanges/[id]/inbound/shipping-method/route.ts b/packages/medusa/src/api/admin/exchanges/[id]/inbound/shipping-method/route.ts index 8d0fb700f2..bd0c6e93d6 100644 --- a/packages/medusa/src/api/admin/exchanges/[id]/inbound/shipping-method/route.ts +++ b/packages/medusa/src/api/admin/exchanges/[id]/inbound/shipping-method/route.ts @@ -52,7 +52,7 @@ export const POST = async ( const [orderReturn] = await remoteQuery(queryObject) res.json({ - order_preview: result, + order_preview: result as unknown as HttpTypes.AdminOrderPreview, return: orderReturn, }) } diff --git a/packages/medusa/src/api/admin/exchanges/[id]/outbound/items/[action_id]/route.ts b/packages/medusa/src/api/admin/exchanges/[id]/outbound/items/[action_id]/route.ts index 45e928fe65..8409ea5350 100644 --- a/packages/medusa/src/api/admin/exchanges/[id]/outbound/items/[action_id]/route.ts +++ b/packages/medusa/src/api/admin/exchanges/[id]/outbound/items/[action_id]/route.ts @@ -43,7 +43,7 @@ export const POST = async ( const [orderExchange] = await remoteQuery(queryObject) res.json({ - order_preview: result, + order_preview: result as unknown as HttpTypes.AdminOrderPreview, exchange: orderExchange, }) } @@ -78,7 +78,7 @@ export const DELETE = async ( const [orderExchange] = await remoteQuery(queryObject) res.json({ - order_preview: orderPreview, + order_preview: orderPreview as unknown as HttpTypes.AdminOrderPreview, exchange: orderExchange, }) } diff --git a/packages/medusa/src/api/admin/exchanges/[id]/outbound/items/route.ts b/packages/medusa/src/api/admin/exchanges/[id]/outbound/items/route.ts index bdb0109af0..6fde48f8b9 100644 --- a/packages/medusa/src/api/admin/exchanges/[id]/outbound/items/route.ts +++ b/packages/medusa/src/api/admin/exchanges/[id]/outbound/items/route.ts @@ -37,7 +37,7 @@ export const POST = async ( const [orderExchange] = await remoteQuery(queryObject) res.json({ - order_preview: result, + order_preview: result as unknown as HttpTypes.AdminOrderPreview, exchange: orderExchange, }) } diff --git a/packages/medusa/src/api/admin/exchanges/[id]/outbound/shipping-method/[action_id]/route.ts b/packages/medusa/src/api/admin/exchanges/[id]/outbound/shipping-method/[action_id]/route.ts index 2f4a095853..b4cd2b86ee 100644 --- a/packages/medusa/src/api/admin/exchanges/[id]/outbound/shipping-method/[action_id]/route.ts +++ b/packages/medusa/src/api/admin/exchanges/[id]/outbound/shipping-method/[action_id]/route.ts @@ -43,7 +43,7 @@ export const POST = async ( const [orderExchange] = await remoteQuery(queryObject) res.json({ - order_preview: result, + order_preview: result as unknown as HttpTypes.AdminOrderPreview, exchange: orderExchange, }) } @@ -78,7 +78,7 @@ export const DELETE = async ( const [orderExchange] = await remoteQuery(queryObject) res.json({ - order_preview: orderPreview, + order_preview: orderPreview as unknown as HttpTypes.AdminOrderPreview, exchange: orderExchange, }) } diff --git a/packages/medusa/src/api/admin/exchanges/[id]/outbound/shipping-method/route.ts b/packages/medusa/src/api/admin/exchanges/[id]/outbound/shipping-method/route.ts index cfae276f21..620877dcf8 100644 --- a/packages/medusa/src/api/admin/exchanges/[id]/outbound/shipping-method/route.ts +++ b/packages/medusa/src/api/admin/exchanges/[id]/outbound/shipping-method/route.ts @@ -36,7 +36,7 @@ export const POST = async ( const [orderExchange] = await remoteQuery(queryObject) res.json({ - order_preview: result, + order_preview: result as unknown as HttpTypes.AdminOrderPreview, exchange: orderExchange, }) } diff --git a/packages/medusa/src/api/admin/exchanges/[id]/request/route.ts b/packages/medusa/src/api/admin/exchanges/[id]/request/route.ts index 5367712c20..5b826a2750 100644 --- a/packages/medusa/src/api/admin/exchanges/[id]/request/route.ts +++ b/packages/medusa/src/api/admin/exchanges/[id]/request/route.ts @@ -58,7 +58,7 @@ export const POST = async ( } res.json({ - order_preview: result, + order_preview: result as unknown as HttpTypes.AdminOrderPreview, exchange: orderExchange, return: orderReturn, }) diff --git a/packages/medusa/src/api/admin/order-edits/[id]/confirm/route.ts b/packages/medusa/src/api/admin/order-edits/[id]/confirm/route.ts index f4d95d4ab2..bac689eb9b 100644 --- a/packages/medusa/src/api/admin/order-edits/[id]/confirm/route.ts +++ b/packages/medusa/src/api/admin/order-edits/[id]/confirm/route.ts @@ -19,6 +19,6 @@ export const POST = async ( }) res.json({ - order_preview: result, + order_preview: result as unknown as HttpTypes.AdminOrderPreview, }) } diff --git a/packages/medusa/src/api/admin/order-edits/[id]/items/[action_id]/route.ts b/packages/medusa/src/api/admin/order-edits/[id]/items/[action_id]/route.ts index 103ddfca40..721f346f8e 100644 --- a/packages/medusa/src/api/admin/order-edits/[id]/items/[action_id]/route.ts +++ b/packages/medusa/src/api/admin/order-edits/[id]/items/[action_id]/route.ts @@ -24,7 +24,7 @@ export const POST = async ( }) res.json({ - order_preview: result, + order_preview: result as unknown as HttpTypes.AdminOrderPreview, }) } @@ -44,6 +44,6 @@ export const DELETE = async ( }) res.json({ - order_preview: orderPreview, + order_preview: orderPreview as unknown as HttpTypes.AdminOrderPreview, }) } diff --git a/packages/medusa/src/api/admin/order-edits/[id]/items/item/[item_id]/route.ts b/packages/medusa/src/api/admin/order-edits/[id]/items/item/[item_id]/route.ts index e0537fdd90..ed281def06 100644 --- a/packages/medusa/src/api/admin/order-edits/[id]/items/item/[item_id]/route.ts +++ b/packages/medusa/src/api/admin/order-edits/[id]/items/item/[item_id]/route.ts @@ -26,6 +26,6 @@ export const POST = async ( }) res.json({ - order_preview: result, + order_preview: result as unknown as HttpTypes.AdminOrderPreview, }) } diff --git a/packages/medusa/src/api/admin/order-edits/[id]/items/route.ts b/packages/medusa/src/api/admin/order-edits/[id]/items/route.ts index 1c9fe71a9a..caafa223c4 100644 --- a/packages/medusa/src/api/admin/order-edits/[id]/items/route.ts +++ b/packages/medusa/src/api/admin/order-edits/[id]/items/route.ts @@ -18,6 +18,6 @@ export const POST = async ( }) res.json({ - order_preview: result, + order_preview: result as unknown as HttpTypes.AdminOrderPreview, }) } diff --git a/packages/medusa/src/api/admin/order-edits/[id]/request/route.ts b/packages/medusa/src/api/admin/order-edits/[id]/request/route.ts index ab89b16228..990a87b316 100644 --- a/packages/medusa/src/api/admin/order-edits/[id]/request/route.ts +++ b/packages/medusa/src/api/admin/order-edits/[id]/request/route.ts @@ -19,6 +19,6 @@ export const POST = async ( }) res.json({ - order_preview: result, + order_preview: result as unknown as HttpTypes.AdminOrderPreview, }) } diff --git a/packages/medusa/src/api/admin/order-edits/[id]/shipping-method/[action_id]/route.ts b/packages/medusa/src/api/admin/order-edits/[id]/shipping-method/[action_id]/route.ts index da19f798ff..79bf65bf8a 100644 --- a/packages/medusa/src/api/admin/order-edits/[id]/shipping-method/[action_id]/route.ts +++ b/packages/medusa/src/api/admin/order-edits/[id]/shipping-method/[action_id]/route.ts @@ -26,7 +26,7 @@ export const POST = async ( ) res.json({ - order_preview: result, + order_preview: result as unknown as HttpTypes.AdminOrderPreview, }) } @@ -46,6 +46,6 @@ export const DELETE = async ( }) res.json({ - order_preview: orderPreview, + order_preview: orderPreview as unknown as HttpTypes.AdminOrderPreview, }) } diff --git a/packages/medusa/src/api/admin/order-edits/[id]/shipping-method/route.ts b/packages/medusa/src/api/admin/order-edits/[id]/shipping-method/route.ts index cd0ba3e13e..d03a140eda 100644 --- a/packages/medusa/src/api/admin/order-edits/[id]/shipping-method/route.ts +++ b/packages/medusa/src/api/admin/order-edits/[id]/shipping-method/route.ts @@ -19,6 +19,6 @@ export const POST = async ( ) res.json({ - order_preview: result, + order_preview: result as unknown as HttpTypes.AdminOrderPreview, }) } diff --git a/packages/medusa/src/api/admin/order-edits/route.ts b/packages/medusa/src/api/admin/order-edits/route.ts index fb47734dd1..d470e492a1 100644 --- a/packages/medusa/src/api/admin/order-edits/route.ts +++ b/packages/medusa/src/api/admin/order-edits/route.ts @@ -18,6 +18,6 @@ export const POST = async ( }) res.json({ - order_change: result, + order_change: result as unknown as HttpTypes.AdminOrderChange, }) } diff --git a/packages/medusa/src/api/admin/return-reasons/[id]/route.ts b/packages/medusa/src/api/admin/return-reasons/[id]/route.ts index 141950a9d3..0f81be9479 100644 --- a/packages/medusa/src/api/admin/return-reasons/[id]/route.ts +++ b/packages/medusa/src/api/admin/return-reasons/[id]/route.ts @@ -2,11 +2,7 @@ import { deleteReturnReasonsWorkflow, updateReturnReasonsWorkflow, } from "@medusajs/core-flows" -import { - AdminReturnReasonResponse, - HttpTypes, - UpdateOrderReturnReasonDTO, -} from "@medusajs/types" +import { AdminReturnReasonResponse, HttpTypes } from "@medusajs/types" import { ContainerRegistrationKeys, MedusaError, @@ -40,7 +36,7 @@ export const GET = async ( } export const POST = async ( - req: AuthenticatedMedusaRequest, + req: AuthenticatedMedusaRequest, res: MedusaResponse ) => { const workflow = updateReturnReasonsWorkflow(req.scope) diff --git a/packages/medusa/src/api/admin/return-reasons/route.ts b/packages/medusa/src/api/admin/return-reasons/route.ts index 2cb61ca257..27038e8500 100644 --- a/packages/medusa/src/api/admin/return-reasons/route.ts +++ b/packages/medusa/src/api/admin/return-reasons/route.ts @@ -1,5 +1,5 @@ import { createReturnReasonsWorkflow } from "@medusajs/core-flows" -import { CreateOrderReturnReasonDTO, HttpTypes } from "@medusajs/types" +import { HttpTypes } from "@medusajs/types" import { ContainerRegistrationKeys, remoteQueryObjectFromString, @@ -36,7 +36,7 @@ export const GET = async ( } export const POST = async ( - req: AuthenticatedMedusaRequest, + req: AuthenticatedMedusaRequest, res: MedusaResponse ) => { const workflow = createReturnReasonsWorkflow(req.scope) diff --git a/packages/medusa/src/api/store/carts/[id]/taxes/route.ts b/packages/medusa/src/api/store/carts/[id]/taxes/route.ts index 798790c698..d4c56242d0 100644 --- a/packages/medusa/src/api/store/carts/[id]/taxes/route.ts +++ b/packages/medusa/src/api/store/carts/[id]/taxes/route.ts @@ -1,11 +1,10 @@ import { updateTaxLinesWorkflow } from "@medusajs/core-flows" import { MedusaRequest, MedusaResponse } from "../../../../../types/routing" import { refetchCart } from "../../helpers" -import { StoreCalculateCartTaxesType } from "../../validators" import { HttpTypes } from "@medusajs/types" export const POST = async ( - req: MedusaRequest, + req: MedusaRequest, res: MedusaResponse ) => { const workflow = updateTaxLinesWorkflow(req.scope) diff --git a/packages/medusa/src/api/store/carts/query-config.ts b/packages/medusa/src/api/store/carts/query-config.ts index 3753abd5e6..e648e2e6ab 100644 --- a/packages/medusa/src/api/store/carts/query-config.ts +++ b/packages/medusa/src/api/store/carts/query-config.ts @@ -25,6 +25,7 @@ export const defaultStoreCartFields = [ "original_shipping_tax_total", "original_shipping_subtotal", "original_shipping_total", + "metadata", "promotions.id", "promotions.code", "promotions.is_automatic",