1
0
mirror of https://github.com/tcgdex/cards-database.git synced 2025-04-22 19:02: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:
Florian Bouillon 2021-11-09 15:23:33 +01:00 committed by GitHub
parent fa6322a635
commit d432b8a826
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -60,6 +60,9 @@ export default class Set implements LocalSet {
public static findOne(lang: SupportedLanguages, params: Partial<Record<keyof Set, any>> = {}) {
const res = (require(`../../../generated/${lang}/sets.json`) as Array<SDKSet>).find((c) => {
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)
})
})