Skip to content

Commit

Permalink
chore(medusa): Align build query utils (#4148)
Browse files Browse the repository at this point in the history
  • Loading branch information
adrien2p authored May 22, 2023
1 parent bf18bd0 commit c0e527d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/yellow-carpets-jam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@medusajs/utils": patch
---

chore(medusa): Align build query utils
8 changes: 6 additions & 2 deletions packages/utils/src/common/build-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,18 @@ function buildWhere<TWhereKeys extends object, TEntity>(
break
default:
if (objectValue != undefined && typeof objectValue === "object") {
where[key].push(buildWhere<any, TEntity>(objectValue))
where[key] = buildWhere<any, TEntity>(objectValue)
return
}
where[key].push(value)
where[key] = value
}
return
})

if (!Array.isArray(where[key])) {
continue
}

if (where[key].length === 1) {
where[key] = where[key][0]
} else {
Expand Down

0 comments on commit c0e527d

Please sign in to comment.