Received and searched names are lowercased.
Endpoint /lottery/by-name now lowercases the path input name and the search query towards mongo.
This commit is contained in:
@@ -98,8 +98,9 @@ const byEpochDate = (req, res) => {
|
||||
|
||||
const byName = (req, res) => {
|
||||
const { name } = req.params;
|
||||
const regexName = new RegExp(name, "i"); // lowercase regex of the name
|
||||
|
||||
return Highscore.find({ name })
|
||||
return Highscore.find({ "name": { $regex : regexName } })
|
||||
.then(async (highscore) => {
|
||||
highscore = highscore[0]
|
||||
if (highscore) {
|
||||
|
||||
Reference in New Issue
Block a user