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
+10 -2
View File
@@ -13,8 +13,16 @@ export function buildQuery<T = any, TDto = any>(
const findOptions: DAL.OptionsQuery<T, any> = {
populate: deduplicate(config.relations ?? []),
fields: config.select as string[],
limit: config.take ?? 15,
offset: config.skip ?? 0,
limit:
(Number.isSafeInteger(config.take) && config.take! >= 0) ||
null === config.take
? config.take ?? undefined
: 15,
offset:
(Number.isSafeInteger(config.skip) && config.skip! >= 0) ||
null === config.skip
? config.skip ?? undefined
: 0,
}
if (config.order) {