feat(tax): add support for updating tax rates (#6537)

This commit is contained in:
Sebastian Rindom
2024-02-29 11:03:18 +00:00
committed by GitHub
parent 2407b443f1
commit 6279fb3c67
11 changed files with 262 additions and 1 deletions
@@ -196,6 +196,27 @@ export default class TaxModuleService<
return await this.taxRateService_.update({ selector, data }, sharedContext)
}
async upsert(
data: TaxTypes.UpsertTaxRateDTO[],
sharedContext?: Context
): Promise<TaxTypes.TaxRateDTO[]>
async upsert(
data: TaxTypes.UpsertTaxRateDTO,
sharedContext?: Context
): Promise<TaxTypes.TaxRateDTO>
@InjectTransactionManager("baseRepository_")
async upsert(
data: TaxTypes.UpsertTaxRateDTO | TaxTypes.UpsertTaxRateDTO[],
@MedusaContext() sharedContext: Context = {}
): Promise<TaxTypes.TaxRateDTO | TaxTypes.TaxRateDTO[]> {
const result = await this.taxRateService_.upsert(data, sharedContext)
const serialized = await this.baseRepository_.serialize<
TaxTypes.TaxRateDTO[]
>(result, { populate: true })
return Array.isArray(data) ? serialized : serialized[0]
}
createTaxRegions(
data: TaxTypes.CreateTaxRegionDTO,
sharedContext?: Context