chore(medusa): Add transaction on mutation actions (2) (#1855)

**What**
Wrap all actions that require the usage of an atomic phase into a transaction from the handler

**Info**
The following end points have been removed since that they rely on non existing stuff and can't be used and are not used
admin - create-order
admin - delete order metadata
admin - set region metadata
admin - remove region metadata

Fixes CORE-358
This commit is contained in:
Adrien de Peretti
2022-08-02 10:23:01 +00:00
committed by GitHub
parent d530ac23d6
commit b603f7dc8f
64 changed files with 433 additions and 306 deletions
@@ -8,7 +8,6 @@ import {
AdminPostRegionsRegionCountriesReq,
AdminPostRegionsRegionFulfillmentProvidersReq,
AdminPostRegionsRegionPaymentProvidersReq,
AdminPostRegionsRegionMetadata,
AdminGetRegionsRegionFulfillmentOptionsRes,
} from "@medusajs/medusa"
import qs from "qs"
@@ -94,38 +93,6 @@ class AdminRegionsResource extends BaseResource {
return this.client.request("GET", path, undefined, {}, customHeaders)
}
/**
* @description adds metadata to a region
* @param id region id
* @param payload metadata
* @param customHeaders
* @returns updated region
*/
setMetadata(
id: string,
payload: AdminPostRegionsRegionMetadata,
customHeaders: Record<string, any> = {}
): ResponsePromise<AdminRegionsRes> {
const path = `/admin/regions/${id}/metadata`
return this.client.request("POST", path, payload, {}, customHeaders)
}
/**
* @description delete a region's metadata key value pair
* @param id region id
* @param key metadata key
* @param customHeaders
* @returns updated region
*/
deleteMetadata(
id: string,
key: string,
customHeaders: Record<string, any> = {}
): ResponsePromise<AdminRegionsRes> {
const path = `/admin/regions/${id}/metadata/${key}`
return this.client.request("DELETE", path, undefined, {}, customHeaders)
}
/**
* @description adds a country to the list of countries in a region
* @param id region id