d0fa89b92b 
					 
					
						
						
							
							Update lottery winner by id.  
						
						 
						
						... 
						
						
						
						Endpoint, controller and repository function for updating lottery winner
by id and json payload.
Keeps previous definition for undefined/null values. 
						
						
					 
					
						2021-02-18 21:05:40 +01:00  
					
					
						 
						
						
							
							
							 
							
							
							
							
							 
						
					 
				 
			
				
					
						
					 
					
						
						
							
						
						fc029f80df 
					 
					
						
						
							
							New message & wine controllers!  
						
						 
						
						... 
						
						
						
						These interface towards the respective repositories.
Wine:
 - /api/wine/:id - getWineById
 - /api/wines - allWines
Messages:
 - /api/lottery/messages/winner/:id - notifyWinnerById 
						
						
					 
					
						2021-02-18 21:02:07 +01:00  
					
					
						 
						
						
							
							
							 
							
							
							
							
							 
						
					 
				 
			
				
					
						
					 
					
						
						
							
						
						824bd60c02 
					 
					
						
						
							
							Updated internal name of wine schema.  
						
						 
						
						
						
						
					 
					
						2021-02-18 21:00:32 +01:00  
					
					
						 
						
						
							
							
							 
							
							
							
							
							 
						
					 
				 
			
				
					
						
					 
					
						
						
							
						
						6003151e3b 
					 
					
						
						
							
							Better error handling for claim prize.  
						
						 
						
						... 
						
						
						
						We wrap await function calls with try catch and return the res if any
error occur. 
						
						
					 
					
						2021-02-18 20:58:57 +01:00  
					
					
						 
						
						
							
							
							 
							
							
							
							
							 
						
					 
				 
			
				
					
						
					 
					
						
						
							
						
						ab58a45da5 
					 
					
						
						
							
							Better var name and response message text.  
						
						 
						
						
						
						
					 
					
						2021-02-18 20:58:40 +01:00  
					
					
						 
						
						
							
							
							 
							
							
							
							
							 
						
					 
				 
			
				
					
						
					 
					
						
						
							
						
						dcaaeae51f 
					 
					
						
						
							
							Get prizes only returns wines without a winner already.  
						
						 
						
						
						
						
					 
					
						2021-02-18 20:58:09 +01:00  
					
					
						 
						
						
							
							
							 
							
							
							
							
							 
						
					 
				 
			
				
					
						
					 
					
						
						
							
						
						9fd67a6bc3 
					 
					
						
						
							
							Removed unused parameter.  
						
						 
						
						
						
						
					 
					
						2021-02-18 20:55:41 +01:00  
					
					
						 
						
						
							
							
							 
							
							
							
							
							 
						
					 
				 
			
				
					
						
					 
					
						
						
							
						
						70c80849df 
					 
					
						
						
							
							No longer delete winner as part of selecting prize.  
						
						 
						
						... 
						
						
						
						Winners are rather marked with prize_selected and have it's own endpoint
to remove all winners. 
						
						
					 
					
						2021-02-18 20:54:15 +01:00  
					
					
						 
						
						
							
							
							 
							
							
							
							
							 
						
					 
				 
			
				
					
						
					 
					
						
						
							
						
						a28a8ccacb 
					 
					
						
						
							
							When selecting prize, add winner to wine.  
						
						 
						
						... 
						
						
						
						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. 
						
						
					 
					
						2021-02-18 20:50:30 +01:00  
					
					
						 
						
						
							
							
							 
							
							
							
							
							 
						
					 
				 
			
				
					
						
					 
					
						
						
							
						
						4bd3b688e9 
					 
					
						
						
							
							Get wines by id or search with wine object.  
						
						 
						
						... 
						
						
						
						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. 
						
						
					 
					
						2021-02-18 20:44:54 +01:00  
					
					
						 
						
						
							
							
							 
							
							
							
							
							 
						
					 
				 
			
				
					
						
					 
					
						
						
							
						
						930c458d9c 
					 
					
						
						
							
							Search history for winner name.  
						
						 
						
						
						
						
					 
					
						2021-02-18 20:40:35 +01:00  
					
					
						 
						
						
							
							
							 
							
							
							
							
							 
						
					 
				 
			
				
					
						
					 
					
						
						
							
						
						787882e753 
					 
					
						
						
							
							History ordered by wins has limit parameter.  
						
						 
						
						
						
						
					 
					
						2021-02-18 20:40:14 +01:00  
					
					
						 
						
						
							
							
							 
							
							
							
							
							 
						
					 
				 
			
				
					
						
					 
					
						
						
							
						
						68b4e96ad0 
					 
					
						
						
							
							Import with lowercase name, it's not a class.  
						
						 
						
						
						
						
					 
					
						2021-02-18 20:39:27 +01:00  
					
					
						 
						
						
							
							
							 
							
							
							
							
							 
						
					 
				 
			
				
					
						
					 
					
						
						
							
						
						56d2513a9c 
					 
					
						
						
							
							Incorrect history.js function called.  
						
						 
						
						
						
						
					 
					
						2021-02-18 20:38:49 +01:00  
					
					
						 
						
						
							
							
							 
							
							
							
							
							 
						
					 
				 
			
				
					
						
					 
					
						
						
							
						
						1c40fae69d 
					 
					
						
						
							
							Repository gets new search winner by query func.  
						
						 
						
						... 
						
						
						
						Has sort parameter that defaults to newest first. 
						
						
					 
					
						2021-02-17 19:26:01 +01:00  
					
					
						 
						
						
							
							
							 
							
							
							
							
							 
						
					 
				 
			
				
					
						
					 
					
						
						
							
						
						bca4558d59 
					 
					
						
						
							
							orderByWins has limit parameter to slice response  
						
						 
						
						... 
						
						
						
						Limit the number of rows returned, used for frontpage where we display
max 20. 
						
						
					 
					
						2021-02-17 19:21:33 +01:00  
					
					
						 
						
						
							
							
							 
							
							
							
							
							 
						
					 
				 
			
				
					
						
					 
					
						
						
							
						
						38eb98e68b 
					 
					
						
						
							
							Sorting happens in mongo query, no longer in js.  
						
						 
						
						
						
						
					 
					
						2021-02-17 19:20:52 +01:00  
					
					
						 
						
						
							
							
							 
							
							
							
							
							 
						
					 
				 
			
				
					
						
					 
					
						
						
							
						
						c98ccbc3f0 
					 
					
						
						
							
							We want a mongo instance of both winner and wine.  
						
						 
						
						... 
						
						
						
						The inputs to these functions are objects, if we want to use mongoose we
need to get a new instance of wine and winner. 
						
						
					 
					
						2021-02-17 19:19:13 +01:00  
					
					
						 
						
						
							
							
							 
							
							
							
							
							 
						
					 
				 
			
				
					
						
					 
					
						
						
							
						
						3d99a3e5f2 
					 
					
						
						
							
							Wine repository gets function for all wines.  
						
						 
						
						
						
						
					 
					
						2021-02-17 19:17:36 +01:00  
					
					
						 
						
						
							
							
							 
							
							
							
							
							 
						
					 
				 
			
				
					
						
					 
					
						
						
							
						
						7292cf7983 
					 
					
						
						
							
							Endpoint for getting wine schema.  
						
						 
						
						... 
						
						
						
						This is for manual registration of prelottery wines from the admin page. 
						
						
					 
					
						2021-02-15 22:38:22 +01:00  
					
					
						 
						
						
							
							
							 
							
							
							
							
							 
						
					 
				 
			
				
					
						
					 
					
						
						
							
						
						57fe7d444b 
					 
					
						
						
							
							Used correct func name for wines from vinmonpolet.  
						
						 
						
						
						
						
					 
					
						2021-02-15 22:34:51 +01:00  
					
					
						 
						
						
							
							
							 
							
							
							
							
							 
						
					 
				 
			
				
					
						
					 
					
						
						
							
						
						cb4a30b5e9 
					 
					
						
						
							
							BIGBOY rewrite.  
						
						 
						
						... 
						
						
						
						All endpoints have been re-worked to be more clear on what they do. They
also all have their own controller now. 
						
						
					 
					
						2021-01-26 23:05:52 +01:00  
					
					
						 
						
						
							
							
							 
							
							
							
							
							 
						
					 
				 
			
				
					
						
					 
					
						
						
							
						
						b321f2cfdd 
					 
					
						
						
							
							Fixed import location for redis.  
						
						 
						
						
						
						
					 
					
						2021-01-26 23:04:15 +01:00  
					
					
						 
						
						
							
							
							 
							
							
							
							
							 
						
					 
				 
			
				
					
						
					 
					
						
						
							
						
						ce480e790a 
					 
					
						
						
							
							Replaced for clearer project structure & new ctrls.  
						
						 
						
						... 
						
						
						
						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. 
						
						
					 
					
						2021-01-26 23:01:49 +01:00  
					
					
						 
						
						
							
							
							 
							
							
							
							
							 
						
					 
				 
			
				
					
						
					 
					
						
						
							
						
						ba86bf3ada 
					 
					
						
						
							
							New custom errors to throw.  
						
						 
						
						
						
						
					 
					
						2021-01-26 23:01:18 +01:00  
					
					
						 
						
						
							
							
							 
							
							
							
							
							 
						
					 
				 
			
				
					
						
					 
					
						
						
							
						
						f4a16bc417 
					 
					
						
						
							
							Removed always setting isAdmin true.  
						
						 
						
						
						
						
					 
					
						2021-01-26 23:01:08 +01:00  
					
					
						 
						
						
							
							
							 
							
							
							
							
							 
						
					 
				 
			
				
					
						
					 
					
						
						
							
						
						4c33708ff4 
					 
					
						
						
							
							Made some required wine attributes optional.  
						
						 
						
						
						
						
					 
					
						2021-01-26 22:59:46 +01:00  
					
					
						 
						
						
							
							
							 
							
							
							
							
							 
						
					 
				 
			
				
					
						
					 
					
						
						
							
						
						87257fd5b2 
					 
					
						
						
							
							Moved everything not lottery out.  
						
						 
						
						... 
						
						
						
						Moved all logic related to lotteryAttendees, lotteryWinners and
prelotteryWines into each their repository and controller.
Now only holds draw, archive and get archived lotteries. 
						
						
					 
					
						2021-01-26 22:58:41 +01:00  
					
					
						 
						
						
							
							
							 
							
							
							
							
							 
						
					 
				 
			
				
					
						
					 
					
						
						
							
						
						ac829052b6 
					 
					
						
						
							
							Wine models now have extra year field.  
						
						 
						
						
						
						
					 
					
						2021-01-26 22:55:43 +01:00  
					
					
						 
						
						
							
							
							 
							
							
							
							
							 
						
					 
				 
			
				
					
						
					 
					
						
						
							
						
						1b1a99ccc3 
					 
					
						
						
							
							Linting and more clear function names.  
						
						 
						
						
						
						
					 
					
						2021-01-26 22:43:18 +01:00  
					
					
						 
						
						
							
							
							 
							
							
							
							
							 
						
					 
				 
			
				
					
						
					 
					
						
						
							
						
						5e018f071d 
					 
					
						
						
							
							Prize distribution for selecting wines.  
						
						 
						
						... 
						
						
						
						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. 
						
						
					 
					
						2021-01-26 22:42:33 +01:00  
					
					
						 
						
						
							
							
							 
							
							
							
							
							 
						
					 
				 
			
				
					
						
					 
					
						
						
							
						
						939e7e34df 
					 
					
						
						
							
							All CRUDS on winners for current lottery.  
						
						 
						
						
						
						
					 
					
						2021-01-26 22:37:36 +01:00  
					
					
						 
						
						
							
							
							 
							
							
							
							
							 
						
					 
				 
			
				
					
						
					 
					
						
						
							
						
						33070ae31a 
					 
					
						
						
							
							Keeps more information when adding prelottery wine  
						
						 
						
						
						
						
					 
					
						2021-01-26 22:35:12 +01:00  
					
					
						 
						
						
							
							
							 
							
							
							
							
							 
						
					 
				 
			
				
					
						
					 
					
						
						
							
						
						6e02c5e393 
					 
					
						
						
							
							Reflecting changes, isolated winner from lottery.  
						
						 
						
						
						
						
					 
					
						2021-01-26 22:32:14 +01:00  
					
					
						 
						
						
							
							
							 
							
							
							
							
							 
						
					 
				 
			
				
					
						
					 
					
						
						
							
						
						b596dc28e8 
					 
					
						
						
							
							Prelotterywine has it's own repo and ctrl.  
						
						 
						
						
						
						
					 
					
						2021-01-26 22:30:19 +01:00  
					
					
						 
						
						
							
							
							 
							
							
							
							
							 
						
					 
				 
			
				
					
						
					 
					
						
						
							
						
						03c0513da3 
					 
					
						
						
							
							Rm from lottery.js attendee has own repo and ctrl.  
						
						 
						
						
						
						
					 
					
						2021-01-26 22:28:27 +01:00  
					
					
						 
						
						
							
							
							 
							
							
							
							
							 
						
					 
				 
			
				
					
						
					 
					
						
						
							
						
						afab4387cc 
					 
					
						
						
							
							Renamed winner.js to history.js.  
						
						 
						
						
						
						
					 
					
						2021-01-26 22:18:47 +01:00  
					
					
						 
						
						
							
							
							 
							
							
							
							
							 
						
					 
				 
			
				
					
						
					 
					
						
						
							
						
						1c1f52308f 
					 
					
						
						
							
							Add winner w/ wine to highscore.  
						
						 
						
						
						
						
					 
					
						2021-01-26 22:12:42 +01:00  
					
					
						 
						
						
							
							
							 
							
							
							
							
							 
						
					 
				 
			
				
					
						
					 
					
						
						
							
						
						f5d3b16f27 
					 
					
						
						
							
							isAdmin default value = false.  
						
						 
						
						
						
						
					 
					
						2021-01-24 15:36:03 +01:00  
					
					
						 
						
						
							
							
							 
							
							
							
							
							 
						
					 
				 
			
				
					
						
					 
					
						
						
							
						
						b5b61784cc 
					 
					
						
						
							
							Add winners manually by posting /lottery/winners.  
						
						 
						
						
						
						
					 
					
						2021-01-24 15:34:58 +01:00  
					
					
						 
						
						
							
							
							 
							
							
							
							
							 
						
					 
				 
			
				
					
						
					 
					
						
						
							
						
						2f3a6aeba7 
					 
					
						
						
							
							Catch exceptions when deleting wines from lottery.  
						
						 
						
						
						
						
					 
					
						2021-01-24 14:03:27 +01:00  
					
					
						 
						
						
							
							
							 
							
							
							
							
							 
						
					 
				 
			
				
					
						
					 
					
						
						
							
						
						84fa1ff925 
					 
					
						
						
							
							Linted.  
						
						 
						
						
						
						
					 
					
						2021-01-24 14:02:53 +01:00  
					
					
						 
						
						
							
							
							 
							
							
							
							
							 
						
					 
				 
			
				
					
						
					 
					
						
						
							
						
						53135acc05 
					 
					
						
						
							
							Get/add/update/delete winners from lottery.  
						
						 
						
						
						
						
					 
					
						2021-01-24 14:01:36 +01:00  
					
					
						 
						
						
							
							
							 
							
							
							
							
							 
						
					 
				 
			
				
					
						
					 
					
						
						
							
						
						fac50805bd 
					 
					
						
						
							
							Get stores from vinmonopolet.  
						
						 
						
						... 
						
						
						
						Update all endpoint names to distinguish between wine and store actions.
Renamed wineController to vinmonopoletController. 
						
						
					 
					
						2021-01-24 14:01:04 +01:00  
					
					
						 
						
						
							
							
							 
							
							
							
							
							 
						
					 
				 
			
				
					
						
					 
					
						
						
							
						
						6d5f0e824f 
					 
					
						
						
							
							Lottery wine functions & controller.  
						
						 
						
						... 
						
						
						
						Split all wine/prelottrey wines into separate controller.
Now also have endpoints for deleting or updating single wine by id. 
						
						
					 
					
						2021-01-24 12:12:52 +01:00  
					
					
						 
						
						
							
							
							 
							
							
							
							
							 
						
					 
				 
			
				
					
						
					 
					
						
						
							
						
						4d822ccb64 
					 
					
						
						
							
							Isolated lottery attendee functs to it's own file.  
						
						 
						
						
						
						
					 
					
						2021-01-24 11:10:49 +01:00  
					
					
						 
						
						
							
							
							 
							
							
							
							
							 
						
					 
				 
			
				
					
						
					 
					
						
						
							
						
						7aa5f7e9ce 
					 
					
						
						
							
							Add, update and delete attendees to lottery.  
						
						 
						
						
						
						
					 
					
						2021-01-24 11:02:04 +01:00  
					
					
						 
						
						
							
							
							 
							
							
							
							
							 
						
					 
				 
			
				
					
						
					 
					
						
						
							
						
						18d8c2c7ca 
					 
					
						
						
							
							Lottery, get/delete attendees.  
						
						 
						
						... 
						
						
						
						Changed so get attendees no longer is done in two endpoints, now we use
req.isAuthenticated() to check if we want to return full or minimal json
data about each attendee. 
						
						
					 
					
						2021-01-24 10:14:00 +01:00  
					
					
						 
						
						
							
							
							 
							
							
							
							
							 
						
					 
				 
			
				
					
						
					 
					
						
						
							
						
						edc4d26647 
					 
					
						
						
							
							User logout can happen in controller.  
						
						 
						
						
						
						
					 
					
						2021-01-24 10:08:39 +01:00  
					
					
						 
						
						
							
							
							 
							
							
							
							
							 
						
					 
				 
			
				
					
						
					 
					
						
						
							
						
						e07e6ae09a 
					 
					
						
						
							
							Winner controller, winners by date, color or name.  
						
						 
						
						... 
						
						
						
						Winner controller replaces a lot of what happens in retrieve did for
aggregating when and what had been won. Now this is more clearly defined
in winner.js.
Also leverage mongo's query more than sorting and aggregating data like
previous implementation where a lot happened in js. 
						
						
					 
					
						2021-01-24 10:05:00 +01:00