chore(medusa,types): [7] Add request types to API routes (#8564)
Add request types as type arguments in API routes. This also includes adding / rearranging types under the `types` package. PR 7/n
This commit is contained in:
1 parent
163205a9a2
commit
571a3d1671
20 files changed
+110
-23
No files matched your search
@@ -0,0 +1,3 @@
|
||||
import { BaseExchange } from "../common";
|
||||
|
||||
export interface AdminExchange extends BaseExchange {}
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from "./entities"
|
||||
export * from "./responses"
|
||||
@@ -0,0 +1,31 @@
|
||||
import { OrderDTO } from "../../../order";
|
||||
import { PaginatedResponse } from "../../common";
|
||||
import { AdminReturn } from "../../return";
|
||||
import { AdminExchange } from "./entities";
|
||||
|
||||
export interface AdminExchangeResponse {
|
||||
exchange: AdminExchange
|
||||
}
|
||||
|
||||
export type AdminExchangeListResponse = PaginatedResponse<{
|
||||
exchanges: AdminExchange
|
||||
}>
|
||||
|
||||
export interface AdminExchangeOrderResponse {
|
||||
order: OrderDTO
|
||||
exchange: AdminExchange
|
||||
}
|
||||
|
||||
export interface AdminExchangePreviewResponse {
|
||||
order_preview: OrderDTO
|
||||
exchange: AdminExchange
|
||||
}
|
||||
|
||||
export interface AdminExchangeRequestResponse extends AdminExchangePreviewResponse {
|
||||
return: AdminReturn
|
||||
}
|
||||
|
||||
export interface AdminExchangeReturnResponse {
|
||||
order_preview: OrderDTO
|
||||
return: AdminReturn
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
import { BaseOrder } from "../order/common";
|
||||
import { AdminBaseReturnItem, AdminReturn } from "../return";
|
||||
|
||||
export interface BaseExchangeItem {
|
||||
id: string
|
||||
exchange_id: string
|
||||
order_id: string
|
||||
item_id: string
|
||||
quantity: number
|
||||
metadata?: Record<string, unknown>
|
||||
created_at: string | null
|
||||
updated_at: string | null
|
||||
}
|
||||
|
||||
export interface BaseExchange extends Omit<BaseOrder, "status" | "version" | "items"> {
|
||||
order_id: string
|
||||
return_items: AdminBaseReturnItem[]
|
||||
additional_items: BaseExchangeItem[]
|
||||
no_notification?: boolean
|
||||
difference_due?: number
|
||||
return?: AdminReturn
|
||||
return_id?: string
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export * from "./admin"
|
||||
@@ -6,6 +6,7 @@ export * from "./collection"
|
||||
export * from "./common"
|
||||
export * from "./currency"
|
||||
export * from "./customer"
|
||||
export * from "./exchange"
|
||||
export * from "./file"
|
||||
export * from "./fulfillment"
|
||||
export * from "./fulfillment-provider"
|
||||
|
||||
@@ -11,4 +11,12 @@ export type AdminOrderListResponse = PaginatedResponse<{
|
||||
|
||||
export interface AdminOrderPreviewResponse {
|
||||
order: AdminOrderPreview
|
||||
}
|
||||
}
|
||||
|
||||
export interface AdminDraftOrderResponse {
|
||||
draft_order: AdminOrder
|
||||
}
|
||||
|
||||
export type AdminDraftOrderListResponse = PaginatedResponse<{
|
||||
draft_orders: AdminOrder
|
||||
}>
|
||||
Reference in new issue
Block a user