fix(medusa,dashboard): don't send price updates for deleted regions/currencies (#9361)

**What**
- Fixes an issue where the admin dashboard would send region prices for deleted regions.
- Also, includes the implementation for `GET /admin/shipping-options/:id` and its corresponding SDK function.

**Why**
- When a region price for a deleted region was sent to the backend it would result in the insert hitting a not null constraint on the currency_code for prices. To avoid this the dashboard should not send region prices for deleted regions. 

**Additional context**
- Prices for deleted regions should ideally not be returned when fetching shipping option prices. However, we don't yet have a mechanism for cleaning up region prices after a region is deleted.

Fixes CC-540
This commit is contained in:
Sebastian Rindom
2024-09-30 11:51:55 +00:00
committed by GitHub
parent 7484cef0fa
commit 852df3f764
8 changed files with 207 additions and 55 deletions
@@ -24,6 +24,21 @@ export class ShippingOption {
)
}
async retrieve(
id: string,
query?: HttpTypes.SelectParams,
headers?: ClientHeaders
) {
return await this.client.fetch<HttpTypes.AdminShippingOptionResponse>(
`/admin/shipping-options/${id}`,
{
method: "GET",
headers,
query,
}
)
}
async update(
id: string,
body: HttpTypes.AdminUpdateShippingOption,