1
0
mirror of https://github.com/tcgdex/cards-database.git synced 2025-04-23 19:32:11 +00:00

fix: Same problem for set subid (#158)

* fix: Fix /sets/:id endpoint to check in lowercase

Signed-off-by: Avior <github@avior.me>

* fix: Same problem for set subid

Signed-off-by: Avior <github@avior.me>
This commit is contained in:
Florian Bouillon 2021-11-10 11:18:18 +01:00 committed by GitHub
parent d432b8a826
commit e12adb1641
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -81,8 +81,8 @@ export default class Card implements LocalCard {
public static findOne(lang: SupportedLanguages, params: Partial<Record<keyof SDKCard, any>> = {}) { public static findOne(lang: SupportedLanguages, params: Partial<Record<keyof SDKCard, any>> = {}) {
const res = (require(`../../../generated/${lang}/cards.json`) as Array<SDKCard>).find((c) => { const res = (require(`../../../generated/${lang}/cards.json`) as Array<SDKCard>).find((c) => {
return objectLoop(params, (it, key) => { return objectLoop(params, (it, key) => {
if (key === 'set') { if (key === 'set' && typeof it === 'string') {
return c['set'].id.includes(it) || c['set'].name.includes(it) return c['set'].id.toLowerCase().includes(it.toLowerCase()) || c['set'].name.toLowerCase().includes(it.toLowerCase())
} }
if (typeof it === "string") { if (typeof it === "string") {
return c[key as 'localId'].toLowerCase().includes(it.toLowerCase()) return c[key as 'localId'].toLowerCase().includes(it.toLowerCase())