fix: Update auth app_metadata when deleting users + customers (#9041)

* wip

* more work

* working on stuff

* more

* fix test

* remove incorrect test

* fix test

* fix: Only allow deletion of yourself

* remove redundant tests
This commit is contained in:
Oli Juhl
2024-09-10 19:58:16 +02:00
committed by GitHub
parent e9e0267aa8
commit 4bf42f7889
14 changed files with 322 additions and 183 deletions
@@ -1,5 +1,5 @@
import {
deleteCustomersWorkflow,
removeCustomerAccountWorkflow,
updateCustomersWorkflow,
} from "@medusajs/core-flows"
import { AdditionalData, HttpTypes } from "@medusajs/types"
@@ -68,10 +68,11 @@ export const DELETE = async (
res: MedusaResponse<HttpTypes.AdminCustomerDeleteResponse>
) => {
const id = req.params.id
const deleteCustomers = deleteCustomersWorkflow(req.scope)
await deleteCustomers.run({
input: { ids: [id] },
await removeCustomerAccountWorkflow(req.scope).run({
input: {
customerId: id,
},
})
res.status(200).json({