diff --git a/server/src/V2/Components/Card.ts b/server/src/V2/Components/Card.ts index 35119e89f..9879d1e21 100644 --- a/server/src/V2/Components/Card.ts +++ b/server/src/V2/Components/Card.ts @@ -80,10 +80,10 @@ export default class Card implements LocalCard { const res = (require(`../../../generated/${lang}/cards.json`) as Array).find((c) => { return objectLoop(params, (it, key) => { if (key === 'set' && typeof it === 'string') { - return ( - lightCheck(c['set'].id, it) || lightCheck(c['set'].name, it) - ) + console.log("set", c['set'].id, it, lightCheck(c['set'].id, it)) + return (c['set'].id === it || lightCheck(c['set'].name, it)) } + console.log("other field", key, c[key as 'localId'], it, lightCheck(c[key as 'localId'], it)) return lightCheck(c[key as 'localId'], it) }) }) diff --git a/server/src/V2/Components/Serie.ts b/server/src/V2/Components/Serie.ts index 0e9a75421..a3809aaa0 100644 --- a/server/src/V2/Components/Serie.ts +++ b/server/src/V2/Components/Serie.ts @@ -31,6 +31,7 @@ export default class Serie implements LocalSerie { public static find(lang: SupportedLanguages, params: Partial> = {}, pagination?: Pagination) { let list = (require(`../../../generated/${lang}/series.json`) as Array) .filter((c) => objectLoop(params, (it, key) => { + if (key === 'id') return c[key] === it return lightCheck(c[key as 'id'], it) })) if (pagination) { @@ -43,7 +44,10 @@ export default class Serie implements LocalSerie { public static findOne(lang: SupportedLanguages, params: Partial> = {}): Serie | undefined { const res = (require(`../../../generated/${lang}/series.json`) as Array) .find((c) => { - return objectLoop(params, (it, key) => lightCheck(c[key as 'id'], it)) + return objectLoop(params, (it, key) => { + if (key === 'id') return c[key] === it + return lightCheck(c[key as 'id'], it) + }) }) if (!res) { return undefined diff --git a/server/src/V2/Components/Set.ts b/server/src/V2/Components/Set.ts index 1a66522c6..f341b842f 100644 --- a/server/src/V2/Components/Set.ts +++ b/server/src/V2/Components/Set.ts @@ -49,7 +49,11 @@ export default class Set implements LocalSet { public static find(lang: SupportedLanguages, params: Partial> = {}, pagination?: Pagination) { let list = (require(`../../../generated/${lang}/sets.json`) as Array) .filter((c) => objectLoop(params, (it, key) => { - + if (key === 'id' || key === 'name') { + return c[key as 'id'].toLowerCase() === it.toLowerCase() + } else if (typeof it === 'string') { + return c[key as 'id'].toLowerCase().includes(it.toLowerCase()) + } return lightCheck(c[key as 'id'], it) })) if (pagination) {