chore(medusa,types): [1] Add request types to API routes (#8558)

Add request types as type arguments in API routes. This also includes adding / rearranging types under the `types` package.

PR 1/n
This commit is contained in:
Shahed Nasser authored and GitHub committed 2024-08-12 11:27:00 +00:00
1 parent dd4147314f
commit 24985cf89d
19 files changed
+86 -30

No files matched your search

@@ -0,0 +1,11 @@
import {
BaseCart,
BaseCartAddress,
BaseCartLineItem,
BaseCartShippingMethod,
} from "../common"
export interface StoreCart extends BaseCart {}
export interface StoreCartLineItem extends BaseCartLineItem {}
export interface StoreCartAddress extends BaseCartAddress {}
export interface StoreCartShippingMethod extends BaseCartShippingMethod {}
@@ -0,0 +1,3 @@
export * from "./entities"
export * from "./payloads"
export * from "./responses"
@@ -1,14 +1,4 @@
import {
BaseCart,
BaseCartAddress,
BaseCartLineItem,
BaseCartShippingMethod,
} from "./common"
export interface StoreCart extends BaseCart {}
export interface StoreCartLineItem extends BaseCartLineItem {}
export interface StoreCartAddress extends BaseCartAddress {}
export interface StoreCartShippingMethod extends BaseCartShippingMethod {}
import { StoreCartAddress, StoreCartLineItem } from "./entities"
export interface StoreCreateCart {
region_id?: string
@@ -0,0 +1,19 @@
import { StoreOrder } from "../../order"
import { StoreCart } from "./entities"
export interface StoreCartResponse {
cart: StoreCart
}
export type StoreCompleteCartResponse = {
type: "cart"
cart: StoreCart
error: {
message: string
name: string
type: string
}
} | {
type: "order"
order: StoreOrder
}
@@ -1,4 +0,0 @@
import { BaseCollection, BaseCollectionListParams } from "./common"
export interface StoreCollection extends BaseCollection {}
export interface StoreCollectionFilters extends BaseCollectionListParams {}
@@ -0,0 +1,3 @@
import { BaseCollection, BaseCollectionListParams } from "../common"
export interface StoreCollection extends BaseCollection {}
@@ -0,0 +1,3 @@
export * from "./entities"
export * from "./queries"
export * from "./responses"
@@ -0,0 +1,3 @@
import { BaseCollectionListParams } from "../common";
export interface StoreCollectionFilters extends BaseCollectionListParams {}
@@ -0,0 +1,10 @@
import { StoreCollection } from "."
import { PaginatedResponse } from "../../common"
export interface StoreCollectionResponse {
collection: StoreCollection
}
export type StoreCollectionListResponse = PaginatedResponse<{
collections: StoreCollection[]
}>