mirror of
https://github.com/tcgdex/cards-database.git
synced 2025-04-23 03:12:10 +00:00
fix: Fix /sets/:id endpoint to check in lowercase (#157)
Signed-off-by: Avior <github@avior.me>
This commit is contained in:
parent
fa6322a635
commit
d432b8a826
@ -60,6 +60,9 @@ export default class Set implements LocalSet {
|
|||||||
public static findOne(lang: SupportedLanguages, params: Partial<Record<keyof Set, any>> = {}) {
|
public static findOne(lang: SupportedLanguages, params: Partial<Record<keyof Set, any>> = {}) {
|
||||||
const res = (require(`../../../generated/${lang}/sets.json`) as Array<SDKSet>).find((c) => {
|
const res = (require(`../../../generated/${lang}/sets.json`) as Array<SDKSet>).find((c) => {
|
||||||
return objectLoop(params, (it, key) => {
|
return objectLoop(params, (it, key) => {
|
||||||
|
if (typeof it === 'string') {
|
||||||
|
return c[key as 'id'].toLowerCase().includes(it.toLowerCase())
|
||||||
|
}
|
||||||
return c[key as 'id'].includes(it)
|
return c[key as 'id'].includes(it)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user