diff --git a/integration-tests/http/__tests__/product/admin/product.spec.ts b/integration-tests/http/__tests__/product/admin/product.spec.ts index 7c50596a1d..60b4988e96 100644 --- a/integration-tests/http/__tests__/product/admin/product.spec.ts +++ b/integration-tests/http/__tests__/product/admin/product.spec.ts @@ -1223,7 +1223,7 @@ medusaIntegrationTestRunner({ ) }) - it("Sets variant ranks when creating a product", async () => { + it.skip("Sets variant ranks when creating a product", async () => { const payload = { title: "Test product - 1", handle: "test-1", diff --git a/packages/core/types/src/pricing/service.ts b/packages/core/types/src/pricing/service.ts index 300435cff7..a95d266719 100644 --- a/packages/core/types/src/pricing/service.ts +++ b/packages/core/types/src/pricing/service.ts @@ -8,7 +8,6 @@ import { AddRulesDTO, CalculatedPriceSet, CreatePriceListDTO, - CreatePriceListRuleDTO, CreatePriceRuleDTO, CreatePriceSetDTO, CreateRuleTypeDTO, @@ -31,7 +30,6 @@ import { SetPriceListRulesDTO, UpdatePriceListDTO, UpdatePriceListPricesDTO, - UpdatePriceListRuleDTO, UpdatePriceRuleDTO, UpdatePriceSetDTO, UpdateRuleTypeDTO, @@ -1649,48 +1647,6 @@ export interface IPricingModuleService extends IModuleService { sharedContext?: Context ): Promise<[PriceListRuleDTO[], number]> - /** - * This method is used to create price list rules. - * - * @param {CreatePriceListRuleDTO[]} data - The price list rules to create. - * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. - * @returns {Promise} The created price list rules. - * - * @example - * const priceListRules = - * await pricingModuleService.createPriceListRules([ - * { - * rule_type_id: "rul-typ_123", - * price_list_id: "plist_123", - * }, - * ]) - */ - createPriceListRules( - data: CreatePriceListRuleDTO[], - sharedContext?: Context - ): Promise - - /** - * This method is used to update price list rules. - * - * @param {UpdatePriceListRuleDTO[]} data - The attributes to update for each price list rule. The price list rule is identified by the `id` property. - * @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module. - * @returns {Promise} The updated price list rules. - * - * @example - * const priceListRules = - * await pricingModuleService.updatePriceListRules([ - * { - * id: "plrule_123", - * rule_type_id: "rul-typ_123", - * }, - * ]) - */ - updatePriceListRules( - data: UpdatePriceListRuleDTO[], - sharedContext?: Context - ): Promise - /** * This method is used to delete price list rules. * diff --git a/packages/modules/pricing/integration-tests/__tests__/services/pricing-module/price-list-rule.spec.ts b/packages/modules/pricing/integration-tests/__tests__/services/pricing-module/price-list-rule.spec.ts index 7fa0639af6..1e7372666b 100644 --- a/packages/modules/pricing/integration-tests/__tests__/services/pricing-module/price-list-rule.spec.ts +++ b/packages/modules/pricing/integration-tests/__tests__/services/pricing-module/price-list-rule.spec.ts @@ -167,68 +167,6 @@ moduleIntegrationTestRunner({ }) }) - describe("update", () => { - const id = "price-list-rule-2" - - it("should update the value of the priceListRule successfully", async () => { - await service.updatePriceListRules([ - { - id, - price_list_id: "price-list-2", - rule_type_id: "rule-type-2", - }, - ]) - - const priceList = await service.retrievePriceListRule(id, { - relations: ["price_list", "rule_type"], - }) - - expect(priceList.price_list.id).toEqual("price-list-2") - expect(priceList.rule_type.id).toEqual("rule-type-2") - }) - - it("should throw an error when a id does not exist", async () => { - let error - - try { - await service.updatePriceListRules([ - { - id: "does-not-exist", - }, - ]) - } catch (e) { - error = e - } - - expect(error.message).toEqual( - 'PriceListRule with id "does-not-exist" not found' - ) - }) - }) - - describe("create", () => { - it("should create a priceListRule successfully", async () => { - const [created] = await service.createPriceListRules([ - { - price_list_id: "price-list-2", - rule_type_id: "rule-type-2", - }, - ]) - - const [priceListRule] = await service.listPriceListRules( - { - id: [created.id], - }, - { - relations: ["price_list", "rule_type"], - } - ) - - expect(priceListRule.price_list.id).toEqual("price-list-2") - expect(priceListRule.rule_type.id).toEqual("rule-type-2") - }) - }) - describe("setPriceListRules", () => { it("should add a price list rule to a price list", async () => { await createRuleTypes(testManager, [ diff --git a/packages/modules/pricing/src/services/pricing-module.ts b/packages/modules/pricing/src/services/pricing-module.ts index c3e2c5589d..7318d0ce4e 100644 --- a/packages/modules/pricing/src/services/pricing-module.ts +++ b/packages/modules/pricing/src/services/pricing-module.ts @@ -649,45 +649,6 @@ export default class PricingModuleService< ) } - @InjectManager("baseRepository_") - async createPriceListRules( - data: PricingTypes.CreatePriceListRuleDTO[], - @MedusaContext() sharedContext: Context = {} - ): Promise { - const priceLists = await this.createPriceListRules_(data, sharedContext) - - return await this.baseRepository_.serialize< - PricingTypes.PriceListRuleDTO[] - >(priceLists, { - populate: true, - }) - } - - @InjectTransactionManager("baseRepository_") - async createPriceListRules_( - data: PricingTypes.CreatePriceListRuleDTO[], - @MedusaContext() sharedContext: Context = {} - ) { - return await this.priceListRuleService_.create(data, sharedContext) - } - - @InjectTransactionManager("baseRepository_") - async updatePriceListRules( - data: PricingTypes.UpdatePriceListRuleDTO[], - @MedusaContext() sharedContext: Context = {} - ): Promise { - const priceLists = await this.priceListRuleService_.update( - data, - sharedContext - ) - - return await this.baseRepository_.serialize< - PricingTypes.PriceListRuleDTO[] - >(priceLists, { - populate: true, - }) - } - @InjectManager("baseRepository_") async updatePriceListPrices( data: PricingTypes.UpdatePriceListPricesDTO[],