10 Commits

Author SHA1 Message Date
Kasper Rynning-Tønnesen
59b4366ed5 fix: Archive but save set winners as winners
If archiving a lottery, let archive-functionality circumvent SMS-service if the winners have been set on the archive page.
- Also remove unused file
2021-03-25 20:15:38 +01:00
68b4e96ad0 Import with lowercase name, it's not a class. 2021-02-18 20:39:27 +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
afab4387cc Renamed winner.js to history.js. 2021-01-26 22:18:47 +01:00
53780878af Renamed to winners. Winners gets controller setup.
Rewrote everything that happened in history to better take advantage of
monogdb instead of doing everything in js.

Our endpoints become:
 - /winners - getAll w/ includeWines and sort query params.
 - /winners/latest - latest winners grouped w/ includeWines query
 params.
 - /winners/by-date - all winners grouped by date w/ includeWines and
 sort.
 - /winners/by-date/:date - get winners per epoch or string date.
 - /winners/by-name/:name - get winner by name parameter w/ sort for
 wins direction.
2021-01-17 16:55:57 +01:00
54c6c0eb97 History actions now have a controller setup. 2021-01-16 12:33:56 +01:00
89389ddc59 Renamed lottery -> history. 2021-01-15 19:16:15 +01:00