API endpoint for getting latest lottery.

This commit is contained in:
2021-02-20 13:29:41 +01:00
parent 7e2b5a5bb0
commit 80e6c91045
3 changed files with 29 additions and 2 deletions

View File

@@ -130,6 +130,10 @@ const allLotteriesIncludingWinners = async (sort = "asc", yearFilter = undefined
});
};
const latestLottery = async () => {
return Lottery.findOne().sort({ date: -1 });
};
const drawWinner = async () => {
let allContestants = await Attendee.find({ winner: false });
@@ -259,5 +263,6 @@ module.exports = {
archive,
lotteryByDate,
allLotteries,
allLotteriesIncludingWinners
allLotteriesIncludingWinners,
latestLottery
};