On /lottery frontend page the count of winners that is sent to frontend
over socketIO started one index higher than it should.
This was from updating how winners are saved in the backend. Our winners
array now no longer needs to be incremented with 1 from the backend.
- GET /history/search
- GET /purchases
- /purchases
- /purchases/summary
- /purchases/:date
- PUT /lottery/winner/:id (not currently used)
- GET /lotteries
- POST /lottery/messages/winner/:id
- requestWineController validates wine object and returns helpfull
error repsonse if anything is missing.
- requestWine uses new endpoint and calls api from within itself.
- Linting.
Separate function for getting all history including the winners object.
Both have sort parameter that is used within the mongo query instead of
doing it in javascript.
Changed the way we register a prize for winner.
Now we have a new prize_selected boolean field on a winner. This is
used to filter on when finding what winners have not selected a prize
yet. This also replaces the previous method of removing virtualWinners
after they selected a prize.
PrelotteryWine also get's a winner reference. This is used to filter on
when finding what prizes are left, and also makes it easier to
archive/register a lottery when the wine has a winner attached.
Search with wine object tries to find wines matching name, year and id.
This is used for finding a wine from a prelottery wine where their _id
do not match.
These files where directly called from the api endpoints. Now all
functoins have been replaced with a controller interfacing to the
endpoint and a repository file for each of the functions.
Moved all logic related to lotteryAttendees, lotteryWinners and
prelotteryWines into each their repository and controller.
Now only holds draw, archive and get archived lotteries.
Moved the same functionality out from lottery.js and simplified a bit.
Now the backend also sends with wines to pick from.
When hitting the controller we check that the user is the next user in
line.