WIP Functionality to request wines for next lottery #24
Reference in New Issue
Block a user
No description provided.
Delete Branch "feat/request-wine"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Idea
Create a route where users are able to search for wines they want to have included in the next lottery, with some functionality to see requested wines. Admins should also have some functionality to clear and pick selected wines to request for pickup at a vinmonopolet store.
Hopefully this will increase the quality of the wines/beverages aswell as increase the quantity of participants in the weekly lottery
Progress
Admin functionality to pick requested wines and then send an order to vimonopolet for pickup of selected wines.Move this to
request.jsand change endpoint to/request/all.@@ -1,5 +1,51 @@const fetch = require('node-fetch')Change to 500x500
Reflect changes above.
Idea for checking if user is admin:
Proof of concept:
In
middleware/mustBeAuthenticatedwe can set aVinlottis-Adminheader to true after the if test that returns an 401 if not authenticated.Set header with:
res.set("Vinlottis-Admin", true).Implementation:
Obs! This will only work for endpoints that use the middleware
mustBeAuthenticated.We could:
server.jsthat adds the header to all requests."/request/all") endpoint.Is this still used?
Is this used?
@@ -1,5 +1,51 @@const fetch = require('node-fetch')Refactor this document to reflect changes to backend route setup.
TODO:
/api/router.js(e.g./wineinfo/search).@@ -9,7 +9,6 @@ const User = require(path.join(__dirname + "/schemas/User"));const apiRouter = require(path.join(__dirname + "/api/router.js"));Reflect changes from #21 and move this to
/api/router.js.This is in the template which is scoped to
thisso we can write:wines == undefined. Also the length of a list will not be less that zero so change check to bewines.length == 0.Shorthand would be
this.wines = await allRequestedWines() || [];Could the item deleted be sent up here and we filter it away instead of making a new request?
Rename too
wineDeletedand emit the wine element.Vinnere ?
fixed
fixed
@@ -9,7 +9,6 @@ const User = require(path.join(__dirname + "/schemas/User"));const apiRouter = require(path.join(__dirname + "/api/router.js"));fixed
fixed
fixed
fixed
fixed
🤷♂️ fixed
Closes #19.
Remove
Remove
Is this used?
fixed
fixed
fixed
fixed