feat: Update customer related typings and sdk methods (#7440)
This commit is contained in:
@@ -2,7 +2,6 @@ import {
|
||||
deleteCustomersWorkflow,
|
||||
updateCustomersWorkflow,
|
||||
} from "@medusajs/core-flows"
|
||||
import { AdminCustomerResponse } from "@medusajs/types"
|
||||
import { MedusaError } from "@medusajs/utils"
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
@@ -10,10 +9,11 @@ import {
|
||||
} from "../../../../types/routing"
|
||||
import { refetchCustomer } from "../helpers"
|
||||
import { AdminUpdateCustomerType } from "../validators"
|
||||
import { AdminCustomer } from "@medusajs/types"
|
||||
|
||||
export const GET = async (
|
||||
req: AuthenticatedMedusaRequest,
|
||||
res: MedusaResponse<AdminCustomerResponse>
|
||||
res: MedusaResponse<{ customer: AdminCustomer }>
|
||||
) => {
|
||||
const customer = await refetchCustomer(
|
||||
req.params.id,
|
||||
@@ -33,7 +33,7 @@ export const GET = async (
|
||||
|
||||
export const POST = async (
|
||||
req: AuthenticatedMedusaRequest<AdminUpdateCustomerType>,
|
||||
res: MedusaResponse<AdminCustomerResponse>
|
||||
res: MedusaResponse<{ customer: AdminCustomer }>
|
||||
) => {
|
||||
const { errors } = await updateCustomersWorkflow(req.scope).run({
|
||||
input: {
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
import { createCustomersWorkflow } from "@medusajs/core-flows"
|
||||
import {
|
||||
AdminCustomerListResponse,
|
||||
AdminCustomerResponse,
|
||||
} from "@medusajs/types"
|
||||
|
||||
import {
|
||||
ContainerRegistrationKeys,
|
||||
remoteQueryObjectFromString,
|
||||
@@ -13,10 +10,11 @@ import {
|
||||
} from "../../../types/routing"
|
||||
import { AdminCreateCustomerType } from "./validators"
|
||||
import { refetchCustomer } from "./helpers"
|
||||
import { AdminCustomer, PaginatedResponse } from "@medusajs/types"
|
||||
|
||||
export const GET = async (
|
||||
req: AuthenticatedMedusaRequest,
|
||||
res: MedusaResponse<AdminCustomerListResponse>
|
||||
res: MedusaResponse<PaginatedResponse<{ customers: AdminCustomer }>>
|
||||
) => {
|
||||
const remoteQuery = req.scope.resolve(ContainerRegistrationKeys.REMOTE_QUERY)
|
||||
|
||||
@@ -41,7 +39,7 @@ export const GET = async (
|
||||
|
||||
export const POST = async (
|
||||
req: AuthenticatedMedusaRequest<AdminCreateCustomerType>,
|
||||
res: MedusaResponse<AdminCustomerResponse>
|
||||
res: MedusaResponse<{ customer: AdminCustomer }>
|
||||
) => {
|
||||
const createCustomers = createCustomersWorkflow(req.scope)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user