/log/schema endpoint for getting prelottery schema template.

This commit is contained in:
2020-03-10 00:23:49 +01:00
parent 6c05a829ac
commit a4960c41b1

View File

@@ -48,11 +48,16 @@ router.route("/log/wines").post(mustBeAuthenticated, async (req, res) => {
res.send(true);
});
router.route("/log").post(async (req, res) => {
if (!req.isAuthenticated()) {
res.send(false);
return;
}
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
}, {});
res.send(nulledSchema)
})
router.route("/log").post(mustBeAuthenticated, async (req, res) => {
await PreLotteryWine.deleteMany();