Revert "feat(core-flows,medusa): Add customer validation on cart update" (#9724)

This commit is contained in:
Riqwan Thamir
2024-10-22 18:26:01 +00:00
committed by GitHub
parent f1b2d22db7
commit d1ce6d4321
6 changed files with 62 additions and 231 deletions
@@ -1,15 +1,11 @@
import { updateCartWorkflowWithCustomerValidation } from "@medusajs/core-flows"
import { updateCartWorkflow } from "@medusajs/core-flows"
import {
AdditionalData,
HttpTypes,
UpdateCartDataDTO,
} from "@medusajs/framework/types"
import {
AuthenticatedMedusaRequest,
MedusaRequest,
MedusaResponse,
} from "@medusajs/framework/http"
import { MedusaRequest, MedusaResponse } from "@medusajs/framework/http"
import { refetchCart } from "../helpers"
export const GET = async (
@@ -26,15 +22,17 @@ export const GET = async (
}
export const POST = async (
req: AuthenticatedMedusaRequest<UpdateCartDataDTO & AdditionalData>,
res: MedusaResponse<HttpTypes.StoreCartResponse>
req: MedusaRequest<UpdateCartDataDTO & AdditionalData>,
res: MedusaResponse<{
cart: HttpTypes.StoreCart
}>
) => {
const workflow = updateCartWorkflowWithCustomerValidation(req.scope)
const workflow = updateCartWorkflow(req.scope)
await workflow.run({
input: {
...req.validatedBody,
id: req.params.id,
auth_customer_id: req.auth_context?.actor_id,
},
})
@@ -46,7 +46,6 @@ export const StoreRemoveCartPromotions = z
export type StoreUpdateCartType = z.infer<typeof UpdateCart>
export const UpdateCart = z
.object({
customer_id: z.string().optional(),
region_id: z.string().optional(),
email: z.string().email().nullish(),
billing_address: z.union([AddressPayload, z.string()]).optional(),