1
0
mirror of https://github.com/tcgdex/cards-database.git synced 2025-08-10 07:51:58 +00:00

fix: StringEndpoint not corresponding to the docs (#210)

This commit is contained in:
2021-12-15 10:50:47 +01:00
committed by GitHub
parent fe7f6a0738
commit 0f05a63198
4 changed files with 171 additions and 235 deletions

View File

@@ -162,8 +162,11 @@ server
}
break
default:
result = Card.find(lang, {[endpointToField[endpoint]]: id})
result = {
name: id,
cards: Card.find(lang, {[endpointToField[endpoint]]: id})
.map((c) => c.resume())
}
}
if (!result) {
return res.status(404).send({error: "Endpoint or id not found"})

View File

@@ -73,6 +73,8 @@ export function lightCheck(source: any, item: any): boolean {
return lightCheck(source[item], true)
} else if (typeof source === 'string') {
return source.toLowerCase().includes(item.toString().toLowerCase())
} else if (typeof source === 'number') {
return source === parseInt(item)
} else {
// console.log(source, item)
return source === item