fix(medusa): Order edit confirmation conflict line items update (#5867)

* fix(medusa): Order edit confirmation conflict line items update

* naming

* Create serious-flowers-provide.md

* another proposal

* fixes
This commit is contained in:
Adrien de Peretti
2023-12-14 14:52:27 +01:00
committed by GitHub
parent 1c6c759aa8
commit 2826605b01
16 changed files with 111 additions and 51 deletions

View File

@@ -97,8 +97,20 @@ export function buildQuery<TWhereKeys extends object, TEntity = unknown>(
*/
function buildWhere<TWhereKeys extends object, TEntity>(
constraints: TWhereKeys
): FindOptionsWhere<TEntity> {
const where: FindOptionsWhere<TEntity> = {}
): FindOptionsWhere<TEntity> | FindOptionsWhere<TEntity>[] {
let where: FindOptionsWhere<TEntity> | FindOptionsWhere<TEntity>[] = {}
if (Array.isArray(constraints)) {
where = []
constraints.forEach((constraint) => {
;(where as FindOptionsWhere<TEntity>[]).push(
buildWhere(constraint) as FindOptionsWhere<TEntity>
)
})
return where
}
for (const [key, value] of Object.entries(constraints)) {
if (value === undefined) {
continue