add endpoint for retrieving all requested wines
This commit is contained in:
@@ -9,6 +9,7 @@ mongoose.connect("mongodb://localhost:27017/vinlottis", {
|
||||
const Purchase = require(path.join(__dirname + "/../schemas/Purchase"));
|
||||
const Wine = require(path.join(__dirname + "/../schemas/Wine"));
|
||||
const Highscore = require(path.join(__dirname + "/../schemas/Highscore"));
|
||||
const RequestedWine = require(path.join(__dirname + "/../schemas/RequestedWine"));
|
||||
const PreLotteryWine = require(path.join(
|
||||
__dirname + "/../schemas/PreLotteryWine"
|
||||
));
|
||||
@@ -103,6 +104,13 @@ router.route("/highscore/statistics").get(async (req, res) => {
|
||||
res.json(highscore);
|
||||
});
|
||||
|
||||
router.route("/wines/all-requested-wines").get(async (req, res) => {
|
||||
const allWines = await RequestedWine.find({}).populate("wine");
|
||||
|
||||
res.json(allWines);
|
||||
});
|
||||
|
||||
|
||||
router.route("/wines/statistics").get(async (req, res) => {
|
||||
const wines = await Wine.find();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user