Fix(medusa, inventory, stock-location, types, utils): Modules sdk build query (#5713)

* remove defaults

* take 2

* works now

* add changeset

* pricing module and pricing service list take null updates

* update handlers

* update product module service with take:null where relevant

* no spread

* note to self:default offset should be 0, not 15
This commit is contained in:
Philip Korsholm
2023-11-27 10:17:42 +00:00
committed by GitHub
parent faa528159d
commit 18afe0b9ad
19 changed files with 103 additions and 45 deletions
@@ -25,6 +25,7 @@ export async function prepareCreatePriceLists({
const variables = {
variant_id: variantIds,
take: null,
}
const query = {
@@ -30,6 +30,7 @@ export async function prepareRemovePriceListPrices({
"price_set_money_amount",
"price_set_money_amount.price_list",
],
take: null,
}
)
@@ -19,6 +19,7 @@ export async function prepareRemoveProductPrices({
const variables = {
id: product_ids,
take: null,
}
const query = {
@@ -19,6 +19,7 @@ export async function prepareRemoveVariantPrices({
const variables = {
variant_id: variant_ids,
take: null,
}
const query = {
@@ -28,6 +28,7 @@ export async function prepareUpdatePriceLists({
const variables = {
variant_id: variantIds,
take: null,
}
const query = {
@@ -22,6 +22,7 @@ export async function removePriceListPriceSetPrices({
},
{
relations: ["money_amount"],
take: null,
}
)
@@ -58,6 +58,7 @@ export async function updateProductVariantsPrepareData({
},
{
select: ["id", "product_id"],
take: null,
}
)
@@ -53,15 +53,18 @@ export async function updateProductsPrepareData({
"collection",
"sales_channels",
],
take: null,
}
)
const productsMap = new Map(products.map((product) => [product.id, product]))
data.products.forEach((productInput) => {
const removedChannels: string[] = []
const addedChannels: string[] = []
const currentProduct = products.find(
(p) => p.id === productInput.id
const currentProduct = productsMap.get(
productInput.id
) as unknown as ProductWithSalesChannelsDTO
if (productInput.sales_channels) {
@@ -35,6 +35,7 @@ export async function updateProducts({
// "profiles",
// "sales_channels",
],
take: null,
}
)
}
@@ -152,6 +152,7 @@ export async function upsertVariantPrices({
},
{
select: ["id", "currency_code", "amount", "min_quantity", "max_quantity"],
take: null,
}
)