Skip to content

Commit

Permalink
Merge branch 'develop' into MedusaNick-patch-2
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Nov 21, 2023
2 parents 0b4ab5a + fd27bc0 commit 4ca9be6
Show file tree
Hide file tree
Showing 9 changed files with 1,518 additions and 164 deletions.
59 changes: 39 additions & 20 deletions packages/types/src/pricing/common/currency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,64 +4,83 @@ import { BaseFilterable } from "../../dal"
* @interface
*
* A currency's data.
*
* @prop code - The code of the currency.
* @prop symbol - The symbol of the currency.
* @prop symbol_native -
* The symbol of the currecy in its native form. This is typically the symbol used when displaying a price.
* @prop name - The name of the currency.
*/
export interface CurrencyDTO {
/**
* The code of the currency.
*/
code: string
/**
* The symbol of the currency.
*/
symbol?: string
/**
* The symbol of the currecy in its native form. This is typically the symbol used when displaying a price.
*/
symbol_native?: string
/**
* The name of the currency.
*/
name?: string
}

/**
* @interface
*
* A currency to create.
*
* @prop code - The code of the currency.
* @prop symbol - The symbol of the currency.
* @prop symbol_native -
* The symbol of the currecy in its native form. This is typically the symbol used when displaying a price.
* @prop name - The name of the currency.
*/
export interface CreateCurrencyDTO {
/**
* The code of the currency.
*/
code: string
/**
* The symbol of the currency.
*/
symbol: string
/**
* The symbol of the currecy in its native form. This is typically the symbol used when displaying a price.
*/
symbol_native: string
/**
* The name of the currency.
*/
name: string
}

/**
* @interface
*
* The data to update in a currency. The `code` is used to identify which currency to update.
*
* @prop code - The code of the currency to update.
* @prop symbol - The symbol of the currency.
* @prop symbol_native -
* The symbol of the currecy in its native form. This is typically the symbol used when displaying a price.
* @prop name - The name of the currency.
*/
export interface UpdateCurrencyDTO {
/**
* The code of the currency to update.
*/
code: string
/**
* The symbol of the currency.
*/
symbol?: string
/**
* The symbol of the currecy in its native form. This is typically the symbol used when displaying a price.
*/
symbol_native?: string
/**
* The name of the currency.
*/
name?: string
}

/**
* @interface
*
* Filters to apply on a currency.
*
* @prop code - The codes to filter the currencies by.
*/
export interface FilterableCurrencyProps
extends BaseFilterable<FilterableCurrencyProps> {
/**
* The codes to filter the currencies by.
*/
code?: string[]
}
90 changes: 65 additions & 25 deletions packages/types/src/pricing/common/money-amount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,75 +6,115 @@ import { PriceSetMoneyAmountDTO } from "./price-set-money-amount";
* @interface
*
* A money amount's data. A money amount represents a price.
*
* @prop id - The ID of the money amount.
* @prop currency_code - The currency code of this money amount.
* @prop currency - The money amount's currency. Since this is a relation, it will only be retrieved if it's passed to the `relations` array of the find-configuration options.
* @prop amount - The price of this money amount.
* @prop min_quantity - The minimum quantity required to be purchased for this price to be applied.
* @prop max_quantity - The maximum quantity required to be purchased for this price to be applied.
*/
export interface MoneyAmountDTO {
/**
* The ID of the money amount.
*/
id: string
/**
* The currency code of this money amount.
*/
currency_code?: string
/**
* The money amount's currency.
*
* @expandable
*/
currency?: CurrencyDTO
/**
* The price of this money amount.
*/
amount?: number
/**
* The minimum quantity required to be purchased for this price to be applied.
*/
min_quantity?: number
/**
* The maximum quantity required to be purchased for this price to be applied.
*/
max_quantity?: number
/**
* The details of the relation between the money amount and its associated price set.
*
* @expandable
*/
price_set_money_amount?: PriceSetMoneyAmountDTO
}

/**
* @interface
*
* The money amount to create.
*
* @prop id - The ID of the money amount.
* @prop currency_code - The currency code of this money amount.
* @prop currency - The currency of this money amount.
* @prop amount - The amount of this money amount.
* @prop min_quantity - The minimum quantity required to be purchased for this money amount to be applied.
* @prop max_quantity - The maximum quantity required to be purchased for this money amount to be applied.
*/
export interface CreateMoneyAmountDTO {
/**
* The ID of the money amount.
*/
id?: string
/**
* The currency code of this money amount.
*/
currency_code: string
/**
* The currency of this money amount.
*/
currency?: CreateCurrencyDTO
/**
* The amount of this money amount.
*/
amount: number
/**
* The minimum quantity required to be purchased for this money amount to be applied.
*/
min_quantity?: number | null
/**
* The maximum quantity required to be purchased for this money amount to be applied.
*/
max_quantity?: number | null
}

/**
* * @interface
* @interface
*
* The data to update in a money amount. The `id` is used to identify which money amount to update.
*
* @prop id - The ID of the money amount to update.
* @prop currency_code - The code of the currency to associate with the money amount.
* @prop currency - The currency to associte with the money amount.
* @prop amount - The price of this money amount.
* @prop min_quantity - The minimum quantity required to be purchased for this money amount to be applied.
* @prop max_quantity - The maximum quantity required to be purchased for this money amount to be applied.
*/
export interface UpdateMoneyAmountDTO {
/**
* The ID of the money amount to update.
*/
id: string
/**
* The code of the currency to associate with the money amount.
*/
currency_code?: string
/**
* The price of this money amount.
*/
amount?: number
/**
* The minimum quantity required to be purchased for this money amount to be applied.
*/
min_quantity?: number
/**
* The maximum quantity required to be purchased for this money amount to be applied.
*/
max_quantity?: number
}

/**
* @interface
*
* Filters to apply on a money amount.
*
* @prop id - IDs to filter money amounts by.
* @prop currency_code - Currency codes to filter money amounts by.
*/
export interface FilterableMoneyAmountProps
extends BaseFilterable<FilterableMoneyAmountProps> {
/**
* IDs to filter money amounts by.
*/
id?: string[]
/**
* Currency codes to filter money amounts by.
*/
currency_code?: string | string[]
}
Loading

0 comments on commit 4ca9be6

Please sign in to comment.