Get all wines with limit parameter.

This commit is contained in:
2021-02-18 22:07:54 +01:00
parent 4ab67877b9
commit 2477f36f96
3 changed files with 26 additions and 3 deletions

View File

@@ -222,6 +222,15 @@ const orderByWins = (req, res) => {
});
}
if (limit && isNaN(limit)) {
return res.status(400).send({
message: "If limit query parameter is provided it must be a number",
success: false
});
} else if (!!!isNaN(limit)) {
limit = Number(limit);
}
return historyRepository
.orderByWins(includeWines == "true", limit)
.then(winners =>