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

@@ -27,8 +27,12 @@ const addWine = async wine => {
}
};
const allWines = () => {
return Wine.find();
const allWines = (limit = undefined) => {
if (limit) {
return Wine.find().limit(limit);
} else {
return Wine.find();
}
};
const wineById = id => {