Commit Graph

821 Commits

Author SHA1 Message Date
KevinMidboe cff64999b3 Removed unused code. 2021-02-18 23:23:37 +01:00
KevinMidboe 710f276a9b Api call from component itself. 2021-02-18 23:23:16 +01:00
KevinMidboe 6e0b2b76fe New admin pages with better isolated functionality.
Draw winner page has:
 - Better user feedback
 - Knows how many wines are left
 - Separat button for starting sms prize distribution.
 - Edit, update and delete wine by id.
RegisterWinePage:
 - Import wine by url.
 - Edit, update and delete wine by id.
2021-02-18 23:18:13 +01:00
KevinMidboe 7234c2fbba Backend endpoint makes it easier consume for graph.
New endpoint has the data aggregated so we don't need to do as much in
js.
Also added simple year select when we have data spanning multiple years.
2021-02-18 23:14:22 +01:00
KevinMidboe d9de155174 Liting and compact prop for thiner styling. 2021-02-18 22:52:51 +01:00
KevinMidboe 7267c5f5bd If admin prop enable editing & more info.
Leveraging the new api supporting CRUD we check if admin prop is true
and display edit, update and delete buttons.
2021-02-18 22:50:54 +01:00
KevinMidboe be70fa6ddf No longer hides if mouse leaves before timeout ends. 2021-02-18 22:49:02 +01:00
KevinMidboe 30a9d30b1e Renamed to reflect archive lottery functionality. 2021-02-18 22:48:37 +01:00
KevinMidboe 2734e9a840 Now dedicated to submitting/archiving lottery.
Removed all other features than adding raffles bought, money received
and mapping of wines and winners.
Also now does api calls from within the component, not external api.js.
Better validation and use of toast plugin for user feedback.
2021-02-18 22:42:25 +01:00
KevinMidboe 3886313351 Renamed to reflect admin attendee functionality. 2021-02-18 22:22:25 +01:00
KevinMidboe fc261b9274 Rewrote to only contain add attendee functions.
The ui for adding a new user is much more friendly and enables adding
using only keyboard.
Leveraging the new api design supporting CRUD we can update & delete
attendees individually.
2021-02-18 22:19:30 +01:00
KevinMidboe 442e0ffbfd Api call from component itself and refactoring. 2021-02-18 22:15:26 +01:00
KevinMidboe 20dc2b8e38 Api call from component itself and linting. 2021-02-18 22:11:09 +01:00
KevinMidboe 2477f36f96 Get all wines with limit parameter. 2021-02-18 22:07:54 +01:00
KevinMidboe 4ab67877b9 New toast plugin, replacing ui/TextToast.vue.
Globally register toast plugin allows us to call this.$toast.info({})
from anywhere for a toast.
Currently styled types:
 - error
 - info
2021-02-18 21:57:29 +01:00
KevinMidboe 6968ccf389 Linting some ui components. 2021-02-18 21:54:01 +01:00
KevinMidboe 8bd41cc691 Much simpler using prizeDistribution endpoints. 2021-02-18 21:44:33 +01:00
KevinMidboe eaf57115e8 Liting. 2021-02-18 21:42:03 +01:00
KevinMidboe cded690fba Api call from component itself and linting. 2021-02-18 21:41:23 +01:00
KevinMidboe eb9e7d4b43 When mounted focus on username input. 2021-02-18 21:35:32 +01:00
KevinMidboe b2755add12 Api call from component itself and linting. 2021-02-18 21:35:18 +01:00
KevinMidboe b5cca00ed4 Liting 2021-02-18 21:18:01 +01:00
KevinMidboe 2cf4095b97 Api call from component itself and linting. 2021-02-18 21:17:22 +01:00
KevinMidboe 72c1896747 Do api call from within the component itself. 2021-02-18 21:15:21 +01:00
KevinMidboe 011aec3dea Tabs redesigned, update url and can show counter.
Tabs have been redesigned and can now display a counter. This counter
can be set by emiting a "counter" event from the child.
Tabs read and set a ?tab={slug} query parameter when changing tab, when
loaded we check for this parameter to automatically select the correct
tab.
2021-02-18 21:10:14 +01:00
KevinMidboe b57fb5f1f8 Admin gets new tabs.
Tabs for registering wines, adding attendees, drawing winner,
registering/archiving lottery and sending push notifications.
Each tab also has a slug and counter attribute.
2021-02-18 21:08:37 +01:00
KevinMidboe 9823197a48 Better validation and error resp validating wines. 2021-02-18 21:06:49 +01:00
KevinMidboe 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
KevinMidboe 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
KevinMidboe 824bd60c02 Updated internal name of wine schema. 2021-02-18 21:00:32 +01:00
KevinMidboe 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
KevinMidboe ab58a45da5 Better var name and response message text. 2021-02-18 20:58:40 +01:00
KevinMidboe dcaaeae51f Get prizes only returns wines without a winner already. 2021-02-18 20:58:09 +01:00
KevinMidboe 9fd67a6bc3 Removed unused parameter. 2021-02-18 20:55:41 +01:00
KevinMidboe 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
KevinMidboe 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
KevinMidboe 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
KevinMidboe 930c458d9c Search history for winner name. 2021-02-18 20:40:35 +01:00
KevinMidboe 787882e753 History ordered by wins has limit parameter. 2021-02-18 20:40:14 +01:00
KevinMidboe 68b4e96ad0 Import with lowercase name, it's not a class. 2021-02-18 20:39:27 +01:00
KevinMidboe 56d2513a9c Incorrect history.js function called. 2021-02-18 20:38:49 +01:00
KevinMidboe 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
KevinMidboe 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
KevinMidboe 38eb98e68b Sorting happens in mongo query, no longer in js. 2021-02-17 19:20:52 +01:00
KevinMidboe 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
KevinMidboe 3d99a3e5f2 Wine repository gets function for all wines. 2021-02-17 19:17:36 +01:00
KevinMidboe 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
KevinMidboe 57fe7d444b Used correct func name for wines from vinmonpolet. 2021-02-15 22:34:51 +01:00
KevinMidboe 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
KevinMidboe 56095cb3e2 Linting. 2021-01-26 23:04:49 +01:00