1
0
mirror of https://github.com/tcgdex/cards-database.git synced 2025-04-22 10:52:10 +00:00

fix: specific request crash (#621)

This commit is contained in:
Benjamin Rousseliere 2025-01-09 23:48:58 +01:00 committed by GitHub
parent a722ecbbda
commit f39956e429
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -124,20 +124,15 @@ export function recordToQuery<T extends object = object>(input: Record<string, s
for (const it of value) {
const params = parseParam(key, it)
if (!query[key]) {
query[key] = params
} else {
if (isObject(params)) {
objectLoop(params, (v, k) => {
(query[key] as any)[k] = v
return
})
} else {
query[key] = params
}
}
query[key] = query[key]
? {
"$and": [
query[key],
params
]
}
: params
}
})
return query as Query<T>