fix(medusa,pricing,types): rules only gets updated/deleted upon passing an explicit object (#5711)

This commit is contained in:
Riqwan Thamir
2023-11-24 13:54:23 +00:00
committed by GitHub
parent 07934cdaac
commit fc1ef29ed9
5 changed files with 124 additions and 53 deletions
+30 -30
View File
@@ -6,7 +6,7 @@ import { RuleTypeDTO } from "./rule-type"
/**
* @enum
*
*
* The price list's status.
*/
export enum PriceListStatus {
@@ -22,7 +22,7 @@ export enum PriceListStatus {
/**
* @enum
*
*
* The price list's type.
*/
export enum PriceListType {
@@ -38,7 +38,7 @@ export enum PriceListType {
/**
* @interface
*
*
* A price list's details.
*/
export interface PriceListDTO {
@@ -68,34 +68,34 @@ export interface PriceListDTO {
number_rules?: number
/**
* The associated price set money amounts.
*
*
* @expandable
*/
price_set_money_amounts?: PriceSetMoneyAmountDTO[]
/**
* The associated money amounts.
*
*
* @expandable
*/
money_amounts?: MoneyAmountDTO[]
/**
* The associated rule types.
*
*
* @expandable
*/
rule_types?: RuleTypeDTO[]
/**
* The price set's rules.
*
*
* @expandable
*/
rules?: PriceListRuleDTO[]
/**
* The price set's rules.
*
*
* @privateRemarks
* Do we need both this and `rules`?
*
*
* @expandable
*/
price_list_rules?: PriceListRuleDTO[]
@@ -103,7 +103,7 @@ export interface PriceListDTO {
/**
* @interface
*
*
* The prices associated with a price list.
*/
export interface PriceListPriceDTO extends CreateMoneyAmountDTO {
@@ -115,15 +115,15 @@ export interface PriceListPriceDTO extends CreateMoneyAmountDTO {
/**
* @interface
*
*
* The price list's rules to be set. Each key of the object is a rule type's `rule_attribute`, and its value
* is the values of the rule.
* is the values of the rule.
*/
export interface CreatePriceListRules extends Record<string, string[]> {}
/**
* @interface
*
*
* The price list to create.
*/
export interface CreatePriceListDTO {
@@ -167,7 +167,7 @@ export interface CreatePriceListDTO {
/**
* @interface
*
*
* The attributes to update in a price list.
*/
export interface UpdatePriceListDTO {
@@ -182,11 +182,11 @@ export interface UpdatePriceListDTO {
/**
* The price list is enabled starting from this date.
*/
starts_at?: string
starts_at?: string | null
/**
* The price list expires after this date.
*/
ends_at?: string
ends_at?: string | null
/**
* The price list's status.
*/
@@ -203,7 +203,7 @@ export interface UpdatePriceListDTO {
/**
* @inteface
*
*
* Filters to apply on price lists.
*/
export interface FilterablePriceListProps
@@ -232,7 +232,7 @@ export interface FilterablePriceListProps
/**
* @interface
*
*
* Filters to apply on price list rules.
*/
export interface FilterablePriceListRuleProps
@@ -264,7 +264,7 @@ export interface FilterablePriceListRuleValueProps
/**
* @interface
*
*
* The price list rule's details.
*/
export interface PriceListRuleDTO {
@@ -274,26 +274,26 @@ export interface PriceListRuleDTO {
id: string
/**
* The value of the rule.
*
*
* @privateRemarks
* Shouldn't this be in PriceListRuleValueDTO only?
*/
value: string
/**
* The associated rule type.
*
*
* @expandable
*/
rule_type: RuleTypeDTO
/**
* The associated price list.
*
*
* @expandable
*/
price_list: PriceListDTO
/**
* The associated rule values.
*
*
* @expandable
*/
price_list_rule_values?: PriceListRuleValueDTO[]
@@ -301,7 +301,7 @@ export interface PriceListRuleDTO {
/**
* @interface
*
*
* The price list rule to create.
*/
export interface CreatePriceListRuleDTO {
@@ -325,7 +325,7 @@ export interface CreatePriceListRuleDTO {
/**
* @interface
*
*
* The attributes to update in a price list rule.
*/
export interface UpdatePriceListRuleDTO {
@@ -353,7 +353,7 @@ export interface UpdatePriceListRuleDTO {
/**
* @interface
*
*
* The price list rule value's details.
*/
export interface PriceListRuleValueDTO {
@@ -367,7 +367,7 @@ export interface PriceListRuleValueDTO {
value: string
/**
* The associated price list rule.
*
*
* @expandable
*/
price_list_rule: PriceListRuleDTO
@@ -387,7 +387,7 @@ export interface UpdatePriceListRuleValueDTO {
/**
* @interface
*
*
* The prices to be added to a price list.
*/
export interface AddPriceListPricesDTO {
@@ -403,7 +403,7 @@ export interface AddPriceListPricesDTO {
/**
* @interface
*
*
* The rules to add to a price list.
*/
export interface SetPriceListRulesDTO {
@@ -420,7 +420,7 @@ export interface SetPriceListRulesDTO {
/**
* @interface
*
*
* The rules to remove from a price list.
*/
export interface RemovePriceListRulesDTO {