Much virtual many lotteries

This commit is contained in:
Kasper Rynning-Tønnesen
2020-03-13 16:37:08 +01:00
parent 6463a53dd7
commit b35dd5a971
14 changed files with 1552 additions and 264 deletions

View File

@@ -7,7 +7,9 @@ mongoose.connect("mongodb://localhost:27017/vinlottis", {
});
const sub = require(path.join(__dirname + "/../api/subscriptions"));
const mustBeAuthenticated = require(path.join(__dirname + "/../middleware/mustBeAuthenticated"))
const mustBeAuthenticated = require(path.join(
__dirname + "/../middleware/mustBeAuthenticated"
));
const Subscription = require(path.join(__dirname + "/../schemas/Subscription"));
const Purchase = require(path.join(__dirname + "/../schemas/Purchase"));
@@ -15,6 +17,9 @@ const Wine = require(path.join(__dirname + "/../schemas/Wine"));
const PreLotteryWine = require(path.join(
__dirname + "/../schemas/PreLotteryWine"
));
const VirtualWinner = require(path.join(
__dirname + "/../schemas/VirtualWinner"
));
const Highscore = require(path.join(__dirname + "/../schemas/Highscore"));
router.use((req, res, next) => {
@@ -49,15 +54,14 @@ router.route("/log/wines").post(mustBeAuthenticated, async (req, res) => {
});
router.route("/log/schema").get(mustBeAuthenticated, async (req, res) => {
let schema = {...PreLotteryWine.schema.obj};
let nulledSchema = Object.keys(schema).reduce(
(accumulator, current) => {
accumulator[current] = "";
return accumulator
}, {});
let schema = { ...PreLotteryWine.schema.obj };
let nulledSchema = Object.keys(schema).reduce((accumulator, current) => {
accumulator[current] = "";
return accumulator;
}, {});
res.send(nulledSchema)
})
res.send(nulledSchema);
});
router.route("/log").post(mustBeAuthenticated, async (req, res) => {
await PreLotteryWine.deleteMany();