diff --git a/packages/core/types/src/http/currency/admin/entities.ts b/packages/core/types/src/http/currency/admin/entities.ts index e644713e4e..16371107ee 100644 --- a/packages/core/types/src/http/currency/admin/entities.ts +++ b/packages/core/types/src/http/currency/admin/entities.ts @@ -1,14 +1,3 @@ -import { RawRounding } from "../../../common" +import { BaseCurrency } from "../common" -export interface AdminCurrency { - code: string - symbol: string - symbol_native: string - name: string - decimal_digits: number - raw_rounding: RawRounding - rounding: number - created_at: string - updated_at: string - deleted_at: string | null -} +export interface AdminCurrency extends BaseCurrency {} diff --git a/packages/core/types/src/http/currency/common.ts b/packages/core/types/src/http/currency/common.ts new file mode 100644 index 0000000000..239f81d488 --- /dev/null +++ b/packages/core/types/src/http/currency/common.ts @@ -0,0 +1,14 @@ +import { RawRounding } from "../../common" + +export interface BaseCurrency { + code: string + symbol: string + symbol_native: string + name: string + decimal_digits: number + rounding: number + raw_rounding: RawRounding + created_at: string + updated_at: string + deleted_at: string | null +} diff --git a/packages/core/types/src/http/currency/index.ts b/packages/core/types/src/http/currency/index.ts index 26b8eb9dad..9de75f2175 100644 --- a/packages/core/types/src/http/currency/index.ts +++ b/packages/core/types/src/http/currency/index.ts @@ -1 +1,3 @@ export * from "./admin" +export * from "./common" +export * from "./store" \ No newline at end of file diff --git a/packages/core/types/src/http/currency/store/entities.ts b/packages/core/types/src/http/currency/store/entities.ts new file mode 100644 index 0000000000..780d46137c --- /dev/null +++ b/packages/core/types/src/http/currency/store/entities.ts @@ -0,0 +1,3 @@ +import { BaseCurrency } from "../common"; + +export interface StoreCurrency extends BaseCurrency {} \ No newline at end of file diff --git a/packages/core/types/src/http/currency/store/index.ts b/packages/core/types/src/http/currency/store/index.ts new file mode 100644 index 0000000000..57fa23181b --- /dev/null +++ b/packages/core/types/src/http/currency/store/index.ts @@ -0,0 +1,2 @@ +export * from "./entities" +export * from "./responses" \ No newline at end of file diff --git a/packages/core/types/src/http/currency/store/responses.ts b/packages/core/types/src/http/currency/store/responses.ts new file mode 100644 index 0000000000..729eed2f7c --- /dev/null +++ b/packages/core/types/src/http/currency/store/responses.ts @@ -0,0 +1,9 @@ +import { PaginatedResponse } from "../../common"; +import { StoreCurrency } from "./entities"; + +export interface StoreCurrencyResponse { + currency: StoreCurrency +} + +export interface StoreCurrencyListResponse + extends PaginatedResponse<{ currencies: StoreCurrency[] }> {} diff --git a/packages/core/types/src/http/customer/store/entities.ts b/packages/core/types/src/http/customer/store/entities.ts new file mode 100644 index 0000000000..fbb37295b7 --- /dev/null +++ b/packages/core/types/src/http/customer/store/entities.ts @@ -0,0 +1,7 @@ +import { + BaseCustomer, + BaseCustomerAddress, +} from "../common" + +export interface StoreCustomer extends BaseCustomer {} +export interface StoreCustomerAddress extends BaseCustomerAddress {} \ No newline at end of file diff --git a/packages/core/types/src/http/customer/store/index.ts b/packages/core/types/src/http/customer/store/index.ts new file mode 100644 index 0000000000..2f1b9df166 --- /dev/null +++ b/packages/core/types/src/http/customer/store/index.ts @@ -0,0 +1,4 @@ +export * from "./entities" +export * from "./payloads" +export * from "./queries" +export * from "./responses" \ No newline at end of file diff --git a/packages/core/types/src/http/customer/store.ts b/packages/core/types/src/http/customer/store/payloads.ts similarity index 51% rename from packages/core/types/src/http/customer/store.ts rename to packages/core/types/src/http/customer/store/payloads.ts index 27e4f25cf2..feb5e7d6a2 100644 --- a/packages/core/types/src/http/customer/store.ts +++ b/packages/core/types/src/http/customer/store/payloads.ts @@ -1,19 +1,9 @@ import { BaseCreateCustomer, BaseCreateCustomerAddress, - BaseCustomer, - BaseCustomerAddress, - BaseCustomerAddressFilters, - BaseCustomerFilters, BaseUpdateCustomer, BaseUpdateCustomerAddress, -} from "./common" - -export interface StoreCustomer extends BaseCustomer {} -export interface StoreCustomerAddress extends BaseCustomerAddress {} -export interface StoreCustomerFilters extends BaseCustomerFilters {} -export interface StoreCustomerAddressFilters - extends BaseCustomerAddressFilters {} +} from "../common" export interface StoreCreateCustomer extends BaseCreateCustomer {} export interface StoreUpdateCustomer extends BaseUpdateCustomer {} diff --git a/packages/core/types/src/http/customer/store/queries.ts b/packages/core/types/src/http/customer/store/queries.ts new file mode 100644 index 0000000000..1f74bf7f0b --- /dev/null +++ b/packages/core/types/src/http/customer/store/queries.ts @@ -0,0 +1,8 @@ +import { + BaseCustomerAddressFilters, + BaseCustomerFilters, +} from "../common" + +export interface StoreCustomerFilters extends BaseCustomerFilters {} +export interface StoreCustomerAddressFilters + extends BaseCustomerAddressFilters {} \ No newline at end of file diff --git a/packages/core/types/src/http/customer/store/responses.ts b/packages/core/types/src/http/customer/store/responses.ts new file mode 100644 index 0000000000..34d8a10465 --- /dev/null +++ b/packages/core/types/src/http/customer/store/responses.ts @@ -0,0 +1,13 @@ +import { PaginatedResponse } from "../../common"; +import { StoreCustomer, StoreCustomerAddress } from "./entities"; + +export interface StoreCustomerResponse { + customer: StoreCustomer +} + +export interface StoreCustomerAddressResponse { + address: StoreCustomerAddress +} + +export interface StoreCustomerAddressListResponse + extends PaginatedResponse<{ addresses: StoreCustomerAddress[] }> {} diff --git a/packages/medusa/src/api/store/currencies/[code]/route.ts b/packages/medusa/src/api/store/currencies/[code]/route.ts index 29e4d9dde9..68c9cbb0df 100644 --- a/packages/medusa/src/api/store/currencies/[code]/route.ts +++ b/packages/medusa/src/api/store/currencies/[code]/route.ts @@ -4,8 +4,12 @@ import { remoteQueryObjectFromString, } from "@medusajs/utils" import { MedusaRequest, MedusaResponse } from "../../../../types/routing" +import { HttpTypes } from "@medusajs/types" -export const GET = async (req: MedusaRequest, res: MedusaResponse) => { +export const GET = async ( + req: MedusaRequest, + res: MedusaResponse +) => { const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY) const variables = { filters: { code: req.params.code } } diff --git a/packages/medusa/src/api/store/currencies/route.ts b/packages/medusa/src/api/store/currencies/route.ts index 51947a58da..d9a46060f5 100644 --- a/packages/medusa/src/api/store/currencies/route.ts +++ b/packages/medusa/src/api/store/currencies/route.ts @@ -3,8 +3,12 @@ import { remoteQueryObjectFromString, } from "@medusajs/utils" import { MedusaRequest, MedusaResponse } from "../../../types/routing" +import { HttpTypes } from "@medusajs/types" -export const GET = async (req: MedusaRequest, res: MedusaResponse) => { +export const GET = async ( + req: MedusaRequest, + res: MedusaResponse +) => { const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY) const queryObject = remoteQueryObjectFromString({ diff --git a/packages/medusa/src/api/store/customers/me/addresses/[address_id]/route.ts b/packages/medusa/src/api/store/customers/me/addresses/[address_id]/route.ts index a3928889a4..5c5d9b3a13 100644 --- a/packages/medusa/src/api/store/customers/me/addresses/[address_id]/route.ts +++ b/packages/medusa/src/api/store/customers/me/addresses/[address_id]/route.ts @@ -18,10 +18,11 @@ import { StoreUpdateCustomerAddressType, } from "../../../validators" import { refetchCustomer } from "../../../helpers" +import { DeleteResponse, HttpTypes } from "@medusajs/types" export const GET = async ( req: AuthenticatedMedusaRequest, - res: MedusaResponse + res: MedusaResponse ) => { const customerId = req.auth_context.actor_id @@ -47,7 +48,7 @@ export const GET = async ( export const POST = async ( req: AuthenticatedMedusaRequest, - res: MedusaResponse + res: MedusaResponse ) => { const id = req.auth_context.actor_id! await validateCustomerAddress(req.scope, id, req.params.address_id) @@ -71,7 +72,7 @@ export const POST = async ( export const DELETE = async ( req: AuthenticatedMedusaRequest, - res: MedusaResponse + res: MedusaResponse> ) => { const id = req.auth_context.actor_id await validateCustomerAddress(req.scope, id, req.params.address_id) diff --git a/packages/medusa/src/api/store/customers/me/addresses/route.ts b/packages/medusa/src/api/store/customers/me/addresses/route.ts index e51e5d3197..ac6d21ab9e 100644 --- a/packages/medusa/src/api/store/customers/me/addresses/route.ts +++ b/packages/medusa/src/api/store/customers/me/addresses/route.ts @@ -13,10 +13,11 @@ import { remoteQueryObjectFromString, } from "@medusajs/utils" import { refetchCustomer } from "../../helpers" +import { HttpTypes } from "@medusajs/types" export const GET = async ( req: AuthenticatedMedusaRequest, - res: MedusaResponse + res: MedusaResponse ) => { const customerId = req.auth_context.actor_id @@ -42,7 +43,7 @@ export const GET = async ( export const POST = async ( req: AuthenticatedMedusaRequest, - res: MedusaResponse + res: MedusaResponse ) => { const customerId = req.auth_context.actor_id diff --git a/packages/medusa/src/api/store/customers/me/route.ts b/packages/medusa/src/api/store/customers/me/route.ts index 8bd180f186..f99a2717c1 100644 --- a/packages/medusa/src/api/store/customers/me/route.ts +++ b/packages/medusa/src/api/store/customers/me/route.ts @@ -10,10 +10,11 @@ import { import { refetchCustomer } from "../helpers" import { MedusaError } from "@medusajs/utils" import { updateCustomersWorkflow } from "@medusajs/core-flows" +import { HttpTypes } from "@medusajs/types" export const GET = async ( req: AuthenticatedMedusaRequest, - res: MedusaResponse + res: MedusaResponse ) => { const id = req.auth_context.actor_id const customer = await refetchCustomer( @@ -34,7 +35,7 @@ export const GET = async ( export const POST = async ( req: AuthenticatedMedusaRequest, - res: MedusaResponse + res: MedusaResponse ) => { const customerId = req.auth_context.actor_id await updateCustomersWorkflow(req.scope).run({ diff --git a/packages/medusa/src/api/store/customers/route.ts b/packages/medusa/src/api/store/customers/route.ts index f0dcf57ef5..de3031096f 100644 --- a/packages/medusa/src/api/store/customers/route.ts +++ b/packages/medusa/src/api/store/customers/route.ts @@ -7,10 +7,11 @@ import { MedusaError } from "@medusajs/utils" import { createCustomerAccountWorkflow } from "@medusajs/core-flows" import { refetchCustomer } from "./helpers" import { StoreCreateCustomerType } from "./validators" +import { HttpTypes } from "@medusajs/types" export const POST = async ( req: AuthenticatedMedusaRequest, - res: MedusaResponse + res: MedusaResponse ) => { // If `actor_id` is present, the request carries authentication for an existing customer if (req.auth_context.actor_id) {