feat: Add currency module and remove currency models from region and pricing modules (#6536)

What:
- Creates a new currency module
- Removes currency model from the pricing module
- Removes currency model from region module
This commit is contained in:
Stevche Radevski authored and GitHub committed 2024-02-29 15:09:59 +00:00
1 parent 06f706a51a
commit dc025302a1
102 files changed
+1502 -2128

No files matched your search

+1
View File
@@ -24,3 +24,4 @@ export * as UserTypes from "./user"
export * as WorkflowTypes from "./workflow"
export * as ApiKeyTypes from "./api-key"
export * as StoreTypes from "./store"
export * as CurrencyTypes from "./currency"
@@ -0,0 +1,38 @@
import { BaseFilterable } from "../../dal"
/**
* @interface
*
* A currency's data.
*/
export interface CurrencyDTO {
/**
* The ISO 3 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
*
* Filters to apply on a currency.
*/
export interface FilterableCurrencyProps
extends BaseFilterable<FilterableCurrencyProps> {
/**
* The codes to filter the currencies by.
*/
code?: string[]
}
@@ -0,0 +1 @@
export * from "./currency"
+2
View File
@@ -0,0 +1,2 @@
export * from "./common"
export * from "./service"
+238
View File
@@ -0,0 +1,238 @@
import { FindConfig } from "../common"
import { RestoreReturn, SoftDeleteReturn } from "../dal"
import { IModuleService } from "../modules-sdk"
import { Context } from "../shared-context"
import { FilterableCurrencyProps, CurrencyDTO } from "./common"
/**
* The main service interface for the currency module.
*/
export interface ICurrencyModuleService extends IModuleService {
/**
* This method retrieves a currency by its code and and optionally based on the provided configurations.
*
* @param {string} code - The code of the currency to retrieve.
* @param {FindConfig<CurrencyDTO>} config -
* The configurations determining how the currency is retrieved. Its properties, such as `select` or `relations`, accept the
* attributes or relations associated with a currency.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<CurrencyDTO>} The retrieved currency.
*
* @example
* A simple example that retrieves a currency by its code:
*
* ```ts
* import {
* initialize as initializeCurrencyModule,
* } from "@medusajs/currency"
*
* async function retrieveCurrency (code: string) {
* const currencyModule = await initializeCurrencyModule()
*
* const currency = await currencyModule.retrieve(
* code
* )
*
* // do something with the currency or return it
* }
* ```
*
* To specify attributes that should be retrieved:
*
* ```ts
* import {
* initialize as initializeCurrencyModule,
* } from "@medusajs/currency"
*
* async function retrieveCurrency (code: string) {
* const currencyModule = await initializeCurrencyModule()
*
* const currency = await currencyModule.retrieve(
* code,
* {
* select: ["symbol_native"]
* }
* )
*
* // do something with the currency or return it
* }
* ```
*/
retrieve(
code: string,
config?: FindConfig<CurrencyDTO>,
sharedContext?: Context
): Promise<CurrencyDTO>
/**
* This method is used to retrieve a paginated list of currencies based on optional filters and configuration.
*
* @param {FilterableCurrencyProps} filters - The filters to apply on the retrieved currencies.
* @param {FindConfig<CurrencyDTO>} config -
* The configurations determining how the currencies are retrieved. Its properties, such as `select` or `relations`, accept the
* attributes or relations associated with a currency.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<CurrencyDTO[]>} The list of currencies.
*
* @example
*
* To retrieve a list of currencies using their codes:
*
* ```ts
* import {
* initialize as initializeCurrencyModule,
* } from "@medusajs/currency"
*
* async function retrieveCurrencies (codes: string[]) {
* const currencyModule = await initializeCurrencyModule()
*
* const currencies = await currencyModule.list(
* {
* code: codes
* },
* )
*
* // do something with the currencies or return them
* }
* ```
*
* To specify attributes that should be retrieved within the money amounts:
*
* ```ts
* import {
* initialize as initializeCurrencyModule,
* } from "@medusajs/currency"
*
* async function retrieveCurrencies (codes: string[]) {
* const currencyModule = await initializeCurrencyModule()
*
* const currencies = await currencyModule.list(
* {
* code: codes
* },
* {
* select: ["symbol_native"]
* }
* )
*
* // do something with the currencies or return them
* }
* ```
*
* By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
*
* ```ts
* import {
* initialize as initializeCurrencyModule,
* } from "@medusajs/currency"
*
* async function retrieveCurrencies (codes: string[], skip: number, take: number) {
* const currencyModule = await initializeCurrencyModule()
*
* const currencies = await currencyModule.list(
* {
* code: codes
* },
* {
* select: ["symbol_native"],
* skip,
* take
* }
* )
*
* // do something with the currencies or return them
* }
* ```
*/
list(
filters?: FilterableCurrencyProps,
config?: FindConfig<CurrencyDTO>,
sharedContext?: Context
): Promise<CurrencyDTO[]>
/**
* This method is used to retrieve a paginated list of currencies along with the total count of available currencies satisfying the provided filters.
*
* @param {FilterableCurrencyProps} filters - The filters to apply on the retrieved currencies.
* @param {FindConfig<CurrencyDTO>} config -
* The configurations determining how the currencies are retrieved. Its properties, such as `select` or `relations`, accept the
* attributes or relations associated with a currency.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<[CurrencyDTO[], number]>} The list of currencies along with the total count.
*
* @example
*
* To retrieve a list of currencies using their codes:
*
* ```ts
* import {
* initialize as initializeCurrencyModule,
* } from "@medusajs/currency"
*
* async function retrieveCurrencies (codes: string[]) {
* const currencyModule = await initializeCurrencyModule()
*
* const [currencies, count] = await currencyModule.listAndCount(
* {
* code: codes
* },
* )
*
* // do something with the currencies or return them
* }
* ```
*
* To specify attributes that should be retrieved within the money amounts:
*
* ```ts
* import {
* initialize as initializeCurrencyModule,
* } from "@medusajs/currency"
*
* async function retrieveCurrencies (codes: string[]) {
* const currencyModule = await initializeCurrencyModule()
*
* const [currencies, count] = await currencyModule.listAndCount(
* {
* code: codes
* },
* {
* select: ["symbol_native"]
* }
* )
*
* // do something with the currencies or return them
* }
* ```
*
* By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
*
* ```ts
* import {
* initialize as initializeCurrencyModule,
* } from "@medusajs/currency"
*
* async function retrieveCurrencies (codes: string[], skip: number, take: number) {
* const currencyModule = await initializeCurrencyModule()
*
* const [currencies, count] = await currencyModule.listAndCount(
* {
* code: codes
* },
* {
* select: ["symbol_native"],
* skip,
* take
* }
* )
*
* // do something with the currencies or return them
* }
* ```
*/
listAndCount(
filters?: FilterableCurrencyProps,
config?: FindConfig<CurrencyDTO>,
sharedContext?: Context
): Promise<[CurrencyDTO[], number]>
}
+1
View File
@@ -34,3 +34,4 @@ export * from "./totals"
export * from "./transaction-base"
export * from "./user"
export * from "./workflow"
export * from "./currency"
@@ -1,86 +0,0 @@
import { BaseFilterable } from "../../dal"
/**
* @interface
*
* A currency's data.
*/
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.
*/
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.
*/
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.
*/
export interface FilterableCurrencyProps
extends BaseFilterable<FilterableCurrencyProps> {
/**
* The codes to filter the currencies by.
*/
code?: string[]
}
@@ -1,4 +1,3 @@
export * from "./currency"
export * from "./money-amount"
export * from "./price-rule"
export * from "./price-set"
@@ -1,6 +1,5 @@
import { BaseFilterable } from "../../dal";
import { CreateCurrencyDTO, CurrencyDTO } from "./currency";
import { PriceSetMoneyAmountDTO } from "./price-set-money-amount";
import { BaseFilterable } from "../../dal"
import { PriceSetMoneyAmountDTO } from "./price-set-money-amount"
/**
* @interface
@@ -16,12 +15,6 @@ export interface MoneyAmountDTO {
* The currency code of this money amount.
*/
currency_code?: string
/**
* The money amount's currency.
*
* @expandable
*/
currency?: CurrencyDTO
/**
* The price of this money amount.
*/
@@ -66,10 +59,6 @@ export interface CreateMoneyAmountDTO {
* The currency code of this money amount.
*/
currency_code: string
/**
* The currency of this money amount.
*/
currency?: CreateCurrencyDTO
/**
* The amount of this money amount.
*/
@@ -1,6 +1,5 @@
import { BaseFilterable } from "../../dal"
import { PriceSetDTO } from "./price-set"
import { PriceSetMoneyAmountDTO } from "./price-set-money-amount"
import { RuleTypeDTO } from "./rule-type"
export interface PriceSetRuleTypeDTO {
+7 -325
View File
@@ -3,7 +3,6 @@ import {
AddPricesDTO,
AddRulesDTO,
CalculatedPriceSet,
CreateCurrencyDTO,
CreateMoneyAmountDTO,
CreatePriceListDTO,
CreatePriceListRuleDTO,
@@ -11,8 +10,6 @@ import {
CreatePriceSetDTO,
CreatePriceSetMoneyAmountRulesDTO,
CreateRuleTypeDTO,
CurrencyDTO,
FilterableCurrencyProps,
FilterableMoneyAmountProps,
FilterablePriceListProps,
FilterablePriceListRuleProps,
@@ -34,7 +31,6 @@ import {
RemovePriceSetRulesDTO,
RuleTypeDTO,
SetPriceListRulesDTO,
UpdateCurrencyDTO,
UpdateMoneyAmountDTO,
UpdatePriceListDTO,
UpdatePriceListRuleDTO,
@@ -935,7 +931,7 @@ export interface IPricingModuleService extends IModuleService {
* const moneyAmount = await pricingService.retrieveMoneyAmount(
* moneyAmountId,
* {
* relations: ["currency"]
* relations: ["price_set_money_amount"]
* }
* )
*
@@ -996,7 +992,7 @@ export interface IPricingModuleService extends IModuleService {
* id: moneyAmountIds
* },
* {
* relations: ["currency"]
* relations: ["price_set_money_amount"]
* }
* )
*
@@ -1019,7 +1015,7 @@ export interface IPricingModuleService extends IModuleService {
* id: moneyAmountIds
* },
* {
* relations: ["currency"],
* relations: ["price_set_money_amount"],
* skip,
* take
* }
@@ -1051,7 +1047,7 @@ export interface IPricingModuleService extends IModuleService {
* ]
* },
* {
* relations: ["currency"],
* relations: ["price_set_money_amount"],
* skip,
* take
* }
@@ -1114,7 +1110,7 @@ export interface IPricingModuleService extends IModuleService {
* id: moneyAmountIds
* },
* {
* relations: ["currency"]
* relations: ["price_set_money_amount"]
* }
* )
*
@@ -1137,7 +1133,7 @@ export interface IPricingModuleService extends IModuleService {
* id: moneyAmountIds
* },
* {
* relations: ["currency"],
* relations: ["price_set_money_amount"],
* skip,
* take
* }
@@ -1169,7 +1165,7 @@ export interface IPricingModuleService extends IModuleService {
* ]
* },
* {
* relations: ["currency"],
* relations: ["price_set_money_amount"],
* skip,
* take
* }
@@ -1333,320 +1329,6 @@ export interface IPricingModuleService extends IModuleService {
sharedContext?: Context
): Promise<Record<string, string[]> | void>
/**
* This method retrieves a currency by its code and and optionally based on the provided configurations.
*
* @param {string} code - The code of the currency to retrieve.
* @param {FindConfig<CurrencyDTO>} config -
* The configurations determining how the currency is retrieved. Its properties, such as `select` or `relations`, accept the
* attributes or relations associated with a currency.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<CurrencyDTO>} The retrieved currency.
*
* @example
* A simple example that retrieves a currency by its code:
*
* ```ts
* import {
* initialize as initializePricingModule,
* } from "@medusajs/pricing"
*
* async function retrieveCurrency (code: string) {
* const pricingService = await initializePricingModule()
*
* const currency = await pricingService.retrieveCurrency(
* code
* )
*
* // do something with the currency or return it
* }
* ```
*
* To specify attributes that should be retrieved:
*
* ```ts
* import {
* initialize as initializePricingModule,
* } from "@medusajs/pricing"
*
* async function retrieveCurrency (code: string) {
* const pricingService = await initializePricingModule()
*
* const currency = await pricingService.retrieveCurrency(
* code,
* {
* select: ["symbol_native"]
* }
* )
*
* // do something with the currency or return it
* }
* ```
*/
retrieveCurrency(
code: string,
config?: FindConfig<CurrencyDTO>,
sharedContext?: Context
): Promise<CurrencyDTO>
/**
* This method is used to retrieve a paginated list of currencies based on optional filters and configuration.
*
* @param {FilterableCurrencyProps} filters - The filters to apply on the retrieved currencies.
* @param {FindConfig<CurrencyDTO>} config -
* The configurations determining how the currencies are retrieved. Its properties, such as `select` or `relations`, accept the
* attributes or relations associated with a currency.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<CurrencyDTO[]>} The list of currencies.
*
* @example
*
* To retrieve a list of currencies using their codes:
*
* ```ts
* import {
* initialize as initializePricingModule,
* } from "@medusajs/pricing"
*
* async function retrieveCurrencies (codes: string[]) {
* const pricingService = await initializePricingModule()
*
* const currencies = await pricingService.listCurrencies(
* {
* code: codes
* },
* )
*
* // do something with the currencies or return them
* }
* ```
*
* To specify attributes that should be retrieved within the money amounts:
*
* ```ts
* import {
* initialize as initializePricingModule,
* } from "@medusajs/pricing"
*
* async function retrieveCurrencies (codes: string[]) {
* const pricingService = await initializePricingModule()
*
* const currencies = await pricingService.listCurrencies(
* {
* code: codes
* },
* {
* select: ["symbol_native"]
* }
* )
*
* // do something with the currencies or return them
* }
* ```
*
* By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
*
* ```ts
* import {
* initialize as initializePricingModule,
* } from "@medusajs/pricing"
*
* async function retrieveCurrencies (codes: string[], skip: number, take: number) {
* const pricingService = await initializePricingModule()
*
* const currencies = await pricingService.listCurrencies(
* {
* code: codes
* },
* {
* select: ["symbol_native"],
* skip,
* take
* }
* )
*
* // do something with the currencies or return them
* }
* ```
*/
listCurrencies(
filters?: FilterableCurrencyProps,
config?: FindConfig<CurrencyDTO>,
sharedContext?: Context
): Promise<CurrencyDTO[]>
/**
* This method is used to retrieve a paginated list of currencies along with the total count of available currencies satisfying the provided filters.
*
* @param {FilterableCurrencyProps} filters - The filters to apply on the retrieved currencies.
* @param {FindConfig<CurrencyDTO>} config -
* The configurations determining how the currencies are retrieved. Its properties, such as `select` or `relations`, accept the
* attributes or relations associated with a currency.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<[CurrencyDTO[], number]>} The list of currencies along with the total count.
*
* @example
*
* To retrieve a list of currencies using their codes:
*
* ```ts
* import {
* initialize as initializePricingModule,
* } from "@medusajs/pricing"
*
* async function retrieveCurrencies (codes: string[]) {
* const pricingService = await initializePricingModule()
*
* const [currencies, count] = await pricingService.listAndCountCurrencies(
* {
* code: codes
* },
* )
*
* // do something with the currencies or return them
* }
* ```
*
* To specify attributes that should be retrieved within the money amounts:
*
* ```ts
* import {
* initialize as initializePricingModule,
* } from "@medusajs/pricing"
*
* async function retrieveCurrencies (codes: string[]) {
* const pricingService = await initializePricingModule()
*
* const [currencies, count] = await pricingService.listAndCountCurrencies(
* {
* code: codes
* },
* {
* select: ["symbol_native"]
* }
* )
*
* // do something with the currencies or return them
* }
* ```
*
* By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
*
* ```ts
* import {
* initialize as initializePricingModule,
* } from "@medusajs/pricing"
*
* async function retrieveCurrencies (codes: string[], skip: number, take: number) {
* const pricingService = await initializePricingModule()
*
* const [currencies, count] = await pricingService.listAndCountCurrencies(
* {
* code: codes
* },
* {
* select: ["symbol_native"],
* skip,
* take
* }
* )
*
* // do something with the currencies or return them
* }
* ```
*/
listAndCountCurrencies(
filters?: FilterableCurrencyProps,
config?: FindConfig<CurrencyDTO>,
sharedContext?: Context
): Promise<[CurrencyDTO[], number]>
/**
* This method is used to create new currencies.
*
* @param {CreateCurrencyDTO[]} data - The currencies to create.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<CurrencyDTO[]>} The list of created currencies.
*
* @example
* import {
* initialize as initializePricingModule,
* } from "@medusajs/pricing"
*
* async function createCurrencies () {
* const pricingService = await initializePricingModule()
*
* const currencies = await pricingService.createCurrencies([
* {
* code: "USD",
* symbol: "$",
* symbol_native: "$",
* name: "US Dollar",
* }
* ])
*
* // do something with the currencies or return them
* }
*/
createCurrencies(
data: CreateCurrencyDTO[],
sharedContext?: Context
): Promise<CurrencyDTO[]>
/**
* This method is used to update existing currencies with the provided data. In each currency object, the currency code must be provided to identify which currency to update.
*
* @param {UpdateCurrencyDTO[]} data - The currencies to update, each having the attributes that should be updated in a currency.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<CurrencyDTO[]>} The list of updated currencies.
*
* @example
* import {
* initialize as initializePricingModule,
* } from "@medusajs/pricing"
*
* async function updateCurrencies () {
* const pricingService = await initializePricingModule()
*
* const currencies = await pricingService.updateCurrencies([
* {
* code: "USD",
* symbol: "$",
* }
* ])
*
* // do something with the currencies or return them
* }
*/
updateCurrencies(
data: UpdateCurrencyDTO[],
sharedContext?: Context
): Promise<CurrencyDTO[]>
/**
* This method is used to delete currencies based on their currency code.
*
* @param {string[]} currencyCodes - Currency codes of the currencies to delete.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<void>} Resolves once the currencies are deleted.
*
* @example
* import {
* initialize as initializePricingModule,
* } from "@medusajs/pricing"
*
* async function deleteCurrencies () {
* const pricingService = await initializePricingModule()
*
* await pricingService.deleteCurrencies(["USD"])
*
* }
*/
deleteCurrencies(
currencyCodes: string[],
sharedContext?: Context
): Promise<void>
/**
* This method is used to retrieve a rule type by its ID and and optionally based on the provided configurations.
*
+2 -98
View File
@@ -19,15 +19,10 @@ export interface RegionDTO {
*/
currency_code: string
/**
* The associated region currency.
*/
currency: RegionCurrencyDTO
/**
* The countries of the region.
*/
countries: CountryDTO[]
countries: RegionCountryDTO[]
metadata?: Record<string, any>
created_at: string
updated_at: string
@@ -36,7 +31,7 @@ export interface RegionDTO {
/**
* The country details.
*/
export interface CountryDTO {
export interface RegionCountryDTO {
/**
* The ID of the country.
*/
@@ -99,97 +94,6 @@ export interface FilterableRegionProps
updated_at?: OperatorMap<string>
}
/**
* The details of a region's country.
*/
export interface RegionCountryDTO {
/**
* The ID of the country.
*/
id: string
/**
* The ISO 2 code of the country.
*/
iso_2: string
/**
* The ISO 3 code of the country.
*/
iso_3: string
/**
* The code number of the country.
*/
num_code: number
/**
* The name of the country.
*/
name: string
/**
* The display name of the country.
*/
display_name: string
}
/**
* The details of a region's currency
*/
export interface RegionCurrencyDTO {
/**
* The code of the currency.
*/
code: string
/**
* The symbol of the currency.
*/
symbol: string
/**
* The name of the currency.
*/
name: string
/**
* The symbol native of the currency.
*/
symbol_native: string
}
/**
* The filters to apply on the retrieved region's currencies.
*/
export interface FilterableRegionCurrencyProps
extends BaseFilterable<FilterableRegionCurrencyProps> {
/**
* The IDs to filter the currencies by.
*/
id?: string[] | string
/**
* Filter currencies by their code.
*/
code?: string[] | string
/**
* Filter currencies by their symbol.
*/
symbol?: string[] | string
/**
* Filter currencies by their name.
*/
name?: string[] | string
/**
* Filter currencies by their native symbol.
*/
symbol_native?: string[] | string
}
/**
* The filters to apply on the retrieved region's countries.
*/
-2
View File
@@ -1,5 +1,3 @@
import { RegionCurrencyDTO } from "./common"
/**
* The region to be created.
*/
+7 -111
View File
@@ -4,10 +4,8 @@ import { IModuleService } from "../modules-sdk"
import { Context } from "../shared-context"
import {
FilterableRegionCountryProps,
FilterableRegionCurrencyProps,
FilterableRegionProps,
RegionCountryDTO,
RegionCurrencyDTO,
RegionDTO,
} from "./common"
import { CreateRegionDTO, UpsertRegionDTO, UpdateRegionDTO } from "./mutations"
@@ -285,36 +283,6 @@ export interface IRegionModuleService extends IModuleService {
sharedContext?: Context
): Promise<RegionCountryDTO[]>
/**
* This method retrieves a currency by its ID.
*
* @param {string} currencyId - The currency's ID.
* @param {FindConfig<RegionCountryDTO>} config - The configurations determining how the region country is retrieved. Its properties, such as `select` or `relations`, accept the
* attributes or relations associated with a region country.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<RegionCurrencyDTO>} The retrieved currency.
*
* @example
* A simple example that retrieves a {type name} by its ID:
*
* ```ts
* {example-code}
* ```
*
* To specify relations that should be retrieved:
*
* ```ts
* {example-code}
* ```
*
*
*/
retrieveCurrency(
currencyId: string,
config?: FindConfig<RegionCountryDTO>,
sharedContext?: Context
): Promise<RegionCurrencyDTO>
/**
* This method retrieves a paginated list of countries along with the total count of available countries satisfying the provided filters.
*
@@ -351,78 +319,6 @@ export interface IRegionModuleService extends IModuleService {
sharedContext?: Context
): Promise<[RegionCountryDTO[], number]>
/**
* This method retrieves a paginated list of currencies based on optional filters and configuration.
*
* @param {FilterableRegionCurrencyProps} filters - The filters to apply on the retrieved region currency.
* @param {FindConfig<RegionCurrencyDTO>} config - The configurations determining how the region currency is retrieved. Its properties, such as `select` or `relations`, accept the
* attributes or relations associated with a region currency.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<RegionCurrencyDTO[]>} The list of currencies.
*
* @example
* To retrieve a list of {type name} using their IDs:
*
* ```ts
* {example-code}
* ```
*
* To specify relations that should be retrieved within the {type name}:
*
* ```ts
* {example-code}
* ```
*
* By default, only the first `{default limit}` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
*
* ```ts
* {example-code}
* ```
*
*
*/
listCurrencies(
filters?: FilterableRegionCurrencyProps,
config?: FindConfig<RegionCurrencyDTO>,
sharedContext?: Context
): Promise<RegionCurrencyDTO[]>
/**
* This method retrieves a paginated list of currencies along with the total count of available currencies satisfying the provided filters.
*
* @param {FilterableRegionCurrencyProps} filters - The filters to apply on the retrieved region currency.
* @param {FindConfig<RegionCurrencyDTO>} config - The configurations determining how the region currency is retrieved. Its properties, such as `select` or `relations`, accept the
* attributes or relations associated with a region currency.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<[RegionCurrencyDTO[], number]>} The list of currencies along with their total count.
*
* @example
* To retrieve a list of {type name} using their IDs:
*
* ```ts
* {example-code}
* ```
*
* To specify relations that should be retrieved within the {type name}:
*
* ```ts
* {example-code}
* ```
*
* By default, only the first `{default limit}` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
*
* ```ts
* {example-code}
* ```
*
*
*/
listAndCountCurrencies(
filters?: FilterableRegionCurrencyProps,
config?: FindConfig<RegionCurrencyDTO>,
sharedContext?: Context
): Promise<[RegionCurrencyDTO[], number]>
/**
* This method soft deletes regions by their IDs.
*
@@ -445,12 +341,12 @@ export interface IRegionModuleService extends IModuleService {
*
* @param {string[]} regionIds - The list of IDs of regions to restore.
* @param {RestoreReturn<TReturnableLinkableKeys>} config - Configurations determining which relations to restore along with each of the regions. You can pass to its `returnLinkableKeys`
* property any of the regions's relation attribute names, such as `currency`.
* property any of the regions's relation attribute names, such as `country`.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<void | Record<string, string[]>>} An object that includes the IDs of related records that were restored, such as the ID of associated currency.
* The object's keys are the ID attribute names of the regions entity's relations, such as `currency_code`,
* @returns {Promise<void | Record<string, string[]>>} An object that includes the IDs of related records that were restored, such as the ID of associated country.
* The object's keys are the ID attribute names of the regions entity's relations, such as `country`,
* and its value is an array of strings, each being the ID of the record associated with the region through this relation,
* such as the IDs of associated currency.
* such as the IDs of associated country.
*
* @example
* {example-code}
@@ -462,13 +358,13 @@ export interface IRegionModuleService extends IModuleService {
): Promise<Record<string, string[]> | void>
/**
* This method creates default countries and currencies.
* This method creates default countries.
*
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<void>} Resolves when the default countries and currencies are created.
* @returns {Promise<void>} Resolves when the default countries are created.
*
* @example
* {example-code}
*/
createDefaultCountriesAndCurrencies(sharedContext?: Context): Promise<void>
createDefaultCountries(sharedContext?: Context): Promise<void>
}