fix: Customer registration (#8896)

* fix: Customer registration

* update test

* one mroe test

* chore: add transformation
This commit is contained in:
Oli Juhl
2024-09-01 11:41:39 +02:00
committed by GitHub
parent 99461e24ab
commit cbb0a6adc7
7 changed files with 269 additions and 10 deletions
@@ -1,3 +1,4 @@
import { HttpTypes } from "@medusajs/types"
import {
ContainerRegistrationKeys,
remoteQueryObjectFromString,
@@ -6,7 +7,6 @@ import {
AuthenticatedMedusaRequest,
MedusaResponse,
} from "../../../types/routing"
import { HttpTypes } from "@medusajs/types"
export const GET = async (
req: AuthenticatedMedusaRequest<HttpTypes.AdminGetFulfillmentProvidersParams>,
@@ -6,6 +6,7 @@ const defaultStoreCustomersFields = [
"last_name",
"phone",
"metadata",
"has_account",
"created_by",
"deleted_at",
"created_at",
@@ -1,12 +1,12 @@
import { MedusaError } from "@medusajs/utils"
import {
AuthenticatedMedusaRequest,
MedusaResponse,
} from "../../../types/routing"
import { MedusaError } from "@medusajs/utils"
import { createCustomerAccountWorkflow } from "@medusajs/core-flows"
import { refetchCustomer } from "./helpers"
import { HttpTypes } from "@medusajs/types"
import { refetchCustomer } from "./helpers"
export const POST = async (
req: AuthenticatedMedusaRequest<HttpTypes.StoreCreateCustomer>,
@@ -21,10 +21,10 @@ export const POST = async (
}
const createCustomers = createCustomerAccountWorkflow(req.scope)
const customersData = req.validatedBody
const customerData = req.validatedBody
const { result } = await createCustomers.run({
input: { customersData, authIdentityId: req.auth_context.auth_identity_id },
input: { customerData, authIdentityId: req.auth_context.auth_identity_id },
})
const customer = await refetchCustomer(