feat(medusa,core-flows,types): adds batch operations to price list prices (#7077)
what: - adds batch operations to price list prices RESOLVES CORE-1969 RESOLVES CORE-1970
This commit is contained in:
1 parent
08dc861dc1
commit
8d356217bd
35 files changed
+735
-630
No files matched your search
@@ -1,3 +1,7 @@
|
||||
import { FindConfig } from "../common"
|
||||
import { RestoreReturn, SoftDeleteReturn } from "../dal"
|
||||
import { IModuleService } from "../modules-sdk"
|
||||
import { Context } from "../shared-context"
|
||||
import {
|
||||
AddPriceListPricesDTO,
|
||||
AddPricesDTO,
|
||||
@@ -33,10 +37,6 @@ import {
|
||||
UpdateRuleTypeDTO,
|
||||
UpsertPriceSetDTO,
|
||||
} from "./common"
|
||||
import { FindConfig } from "../common"
|
||||
import { RestoreReturn, SoftDeleteReturn } from "../dal"
|
||||
import { IModuleService } from "../modules-sdk"
|
||||
import { Context } from "../shared-context"
|
||||
|
||||
/**
|
||||
* The main service interface for the Pricing Module.
|
||||
@@ -1734,7 +1734,7 @@ export interface IPricingModuleService extends IModuleService {
|
||||
addPriceListPrices(
|
||||
data: AddPriceListPricesDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<PriceListDTO[]>
|
||||
): Promise<PriceDTO[]>
|
||||
|
||||
/**
|
||||
* This method updates existing price list's prices.
|
||||
@@ -1742,7 +1742,7 @@ export interface IPricingModuleService extends IModuleService {
|
||||
* @param {UpdatePriceListPricesDTO[]} data - The attributes to update in a price list's prices. The price list's ID is specified
|
||||
* in the `price_list_id` field.
|
||||
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
||||
* @returns {Promise<PriceListDTO[]>} The updated price list's prices.
|
||||
* @returns {Promise<PriceDTO[]>} The updated price list's prices.
|
||||
*
|
||||
* @example
|
||||
* const priceLists =
|
||||
@@ -1763,7 +1763,7 @@ export interface IPricingModuleService extends IModuleService {
|
||||
updatePriceListPrices(
|
||||
data: UpdatePriceListPricesDTO[],
|
||||
sharedContext?: Context
|
||||
): Promise<PriceListDTO[]>
|
||||
): Promise<PriceDTO[]>
|
||||
|
||||
/**
|
||||
* This method is used to set the rules of a price list. Previous rules are removed.
|
||||
@@ -1771,7 +1771,7 @@ export interface IPricingModuleService extends IModuleService {
|
||||
* @param {SetPriceListRulesDTO} data - The rules to set for a price list. The price list is identified by the
|
||||
* `price_list_id` property.
|
||||
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
|
||||
* @returns {Promise<PriceListDTO>} The updated price list.
|
||||
* @returns {Promise<PriceDTO>} The updated price list's prices.
|
||||
*
|
||||
* @example
|
||||
* const priceList =
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { PricingTypes } from "../bundles"
|
||||
import { PriceListStatus } from "./common"
|
||||
|
||||
export interface CreatePriceListPriceWorkflowDTO {
|
||||
@@ -9,6 +10,16 @@ export interface CreatePriceListPriceWorkflowDTO {
|
||||
rules?: Record<string, string>
|
||||
}
|
||||
|
||||
export interface UpdatePriceListPriceWorkflowDTO {
|
||||
id: string
|
||||
variant_id: string
|
||||
amount?: number
|
||||
currency_code?: string
|
||||
max_quantity?: number
|
||||
min_quantity?: number
|
||||
rules?: Record<string, string>
|
||||
}
|
||||
|
||||
export interface CreatePriceListWorkflowInputDTO {
|
||||
title: string
|
||||
description: string
|
||||
@@ -16,7 +27,7 @@ export interface CreatePriceListWorkflowInputDTO {
|
||||
ends_at?: string | null
|
||||
status?: PriceListStatus
|
||||
rules?: Record<string, string[]>
|
||||
prices: CreatePriceListPriceWorkflowDTO[]
|
||||
prices?: CreatePriceListPriceWorkflowDTO[]
|
||||
}
|
||||
|
||||
export interface UpdatePriceListWorkflowInputDTO {
|
||||
@@ -31,15 +42,20 @@ export interface UpdatePriceListWorkflowInputDTO {
|
||||
|
||||
export interface UpdatePriceListPricesWorkflowDTO {
|
||||
id: string
|
||||
prices: {
|
||||
id: string
|
||||
variant_id: string
|
||||
amount?: number
|
||||
currency_code?: string
|
||||
max_quantity?: number
|
||||
min_quantity?: number
|
||||
rules?: Record<string, string>
|
||||
}[]
|
||||
prices: UpdatePriceListPriceWorkflowDTO[]
|
||||
}
|
||||
|
||||
export interface BatchPriceListPricesWorkflowDTO {
|
||||
id: string
|
||||
create: CreatePriceListPriceWorkflowDTO[]
|
||||
update: UpdatePriceListPriceWorkflowDTO[]
|
||||
delete: string[]
|
||||
}
|
||||
|
||||
export interface BatchPriceListPricesWorkflowResult {
|
||||
created: PricingTypes.PriceDTO[]
|
||||
updated: PricingTypes.PriceDTO[]
|
||||
deleted: string[]
|
||||
}
|
||||
|
||||
export interface CreatePriceListPricesWorkflowDTO {
|
||||
|
||||
Reference in new issue
Block a user