feat: delete shipping options (#6993)
This commit is contained in:
committed by
GitHub
parent
21be6ff7ed
commit
e1a0960e20
@@ -115,7 +115,7 @@ describe("Abstract Module Service Factory", () => {
|
||||
|
||||
it("should have softDelete method", async () => {
|
||||
const result = await instance.softDelete("1")
|
||||
expect(result).toEqual(undefined)
|
||||
expect(result).toEqual({})
|
||||
expect(
|
||||
containerMock.mainModelMockService.softDelete
|
||||
).toHaveBeenCalledWith(["1"], defaultTransactionContext)
|
||||
@@ -123,7 +123,7 @@ describe("Abstract Module Service Factory", () => {
|
||||
|
||||
it("should have restore method", async () => {
|
||||
const result = await instance.restore("1")
|
||||
expect(result).toEqual(undefined)
|
||||
expect(result).toEqual({})
|
||||
expect(containerMock.mainModelMockService.restore).toHaveBeenCalledWith(
|
||||
["1"],
|
||||
defaultTransactionContext
|
||||
@@ -175,7 +175,7 @@ describe("Abstract Module Service Factory", () => {
|
||||
|
||||
it("should have softDelete method for other models", async () => {
|
||||
const result = await instance.softDeleteOtherModelMock1s("1")
|
||||
expect(result).toEqual(undefined)
|
||||
expect(result).toEqual({})
|
||||
expect(
|
||||
containerMock.otherModelMock1Service.softDelete
|
||||
).toHaveBeenCalledWith(["1"], defaultTransactionContext)
|
||||
@@ -183,7 +183,7 @@ describe("Abstract Module Service Factory", () => {
|
||||
|
||||
it("should have restore method for other models", async () => {
|
||||
const result = await instance.restoreOtherModelMock1s("1")
|
||||
expect(result).toEqual(undefined)
|
||||
expect(result).toEqual({})
|
||||
expect(containerMock.otherModelMock1Service.restore).toHaveBeenCalledWith(
|
||||
["1"],
|
||||
defaultTransactionContext
|
||||
|
||||
@@ -12,11 +12,11 @@ import {
|
||||
SoftDeleteReturn,
|
||||
} from "@medusajs/types"
|
||||
import {
|
||||
MapToConfig,
|
||||
isString,
|
||||
kebabCase,
|
||||
lowerCaseFirst,
|
||||
mapObjectTo,
|
||||
MapToConfig,
|
||||
pluralize,
|
||||
upperCaseFirst,
|
||||
} from "../common"
|
||||
@@ -505,18 +505,15 @@ export function abstractModuleServiceFactory<
|
||||
}))
|
||||
)
|
||||
|
||||
let mappedCascadedEntitiesMap
|
||||
if (config.returnLinkableKeys) {
|
||||
// Map internal table/column names to their respective external linkable keys
|
||||
// eg: product.id = product_id, variant.id = variant_id
|
||||
mappedCascadedEntitiesMap = mapObjectTo(
|
||||
cascadedEntitiesMap,
|
||||
entityNameToLinkableKeysMap,
|
||||
{
|
||||
pick: config.returnLinkableKeys,
|
||||
}
|
||||
)
|
||||
}
|
||||
// Map internal table/column names to their respective external linkable keys
|
||||
// eg: product.id = product_id, variant.id = variant_id
|
||||
const mappedCascadedEntitiesMap = mapObjectTo(
|
||||
cascadedEntitiesMap,
|
||||
entityNameToLinkableKeysMap,
|
||||
{
|
||||
pick: config.returnLinkableKeys,
|
||||
}
|
||||
)
|
||||
|
||||
return mappedCascadedEntitiesMap ? mappedCascadedEntitiesMap : void 0
|
||||
}
|
||||
@@ -540,17 +537,15 @@ export function abstractModuleServiceFactory<
|
||||
].restore(primaryKeyValues_, sharedContext)
|
||||
|
||||
let mappedCascadedEntitiesMap
|
||||
if (config.returnLinkableKeys) {
|
||||
// Map internal table/column names to their respective external linkable keys
|
||||
// eg: product.id = product_id, variant.id = variant_id
|
||||
mappedCascadedEntitiesMap = mapObjectTo(
|
||||
cascadedEntitiesMap,
|
||||
entityNameToLinkableKeysMap,
|
||||
{
|
||||
pick: config.returnLinkableKeys,
|
||||
}
|
||||
)
|
||||
}
|
||||
// Map internal table/column names to their respective external linkable keys
|
||||
// eg: product.id = product_id, variant.id = variant_id
|
||||
mappedCascadedEntitiesMap = mapObjectTo(
|
||||
cascadedEntitiesMap,
|
||||
entityNameToLinkableKeysMap,
|
||||
{
|
||||
pick: config.returnLinkableKeys,
|
||||
}
|
||||
)
|
||||
|
||||
return mappedCascadedEntitiesMap ? mappedCascadedEntitiesMap : void 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user