WIP Functionality to request wines for next lottery #24

Merged
Adrianht merged 23 commits from feat/request-wine into master 2020-09-07 14:28:31 +00:00
3 changed files with 18 additions and 4 deletions
Showing only changes of commit aea808dae1 - Show all commits

View File

@@ -2,7 +2,7 @@ const express = require("express");
KevinMidboe commented 2020-09-07 14:00:35 +00:00 (Migrated from github.com)
Review

Is this used?

Is this used?
KevinMidboe commented 2020-09-07 14:00:35 +00:00 (Migrated from github.com)
Review

Is this used?

Is this used?
Adrianht commented 2020-09-07 14:23:56 +00:00 (Migrated from github.com)
Review

fixed

fixed
Adrianht commented 2020-09-07 14:23:56 +00:00 (Migrated from github.com)
Review

fixed

fixed
const path = require("path");
const router = express.Router();
const fetch = require('node-fetch')
const config = require(path.join(__dirname + "/../config/env/vinmonopolet.config"));
KevinMidboe commented 2020-09-07 14:00:35 +00:00 (Migrated from github.com)
Review

Is this used?

Is this used?
Adrianht commented 2020-09-07 14:23:56 +00:00 (Migrated from github.com)
Review

fixed

fixed
const config = require(path.join(__dirname + "/../config/env/lottery.config"));
KevinMidboe commented 2020-09-07 14:00:35 +00:00 (Migrated from github.com)
Review

Is this used?

Is this used?
Adrianht commented 2020-09-07 14:23:56 +00:00 (Migrated from github.com)
Review

fixed

fixed
const mustBeAuthenticated = require(path.join(__dirname + "/../middleware/mustBeAuthenticated"))
@@ -32,7 +32,7 @@ router.route("/wineinfo/search").get(async (req, res) => {
KevinMidboe commented 2020-09-07 14:00:35 +00:00 (Migrated from github.com)
Review

Is this used?

Is this used?
KevinMidboe commented 2020-09-07 14:00:35 +00:00 (Migrated from github.com)
Review

Is this used?

Is this used?
Adrianht commented 2020-09-07 14:23:56 +00:00 (Migrated from github.com)
Review

fixed

fixed
Adrianht commented 2020-09-07 14:23:56 +00:00 (Migrated from github.com)
Review

fixed

fixed
const vinmonopoletResponse = await fetch(url, {
headers: {
"Ocp-Apim-Subscription-Key": `${config.gatewayToken}`
KevinMidboe commented 2020-09-07 14:00:35 +00:00 (Migrated from github.com)
Review

Is this used?

Is this used?
Adrianht commented 2020-09-07 14:23:56 +00:00 (Migrated from github.com)
Review

fixed

fixed
"Ocp-Apim-Subscription-Key": config.vinmonopoletToken
KevinMidboe commented 2020-09-07 14:00:35 +00:00 (Migrated from github.com)
Review

Is this used?

Is this used?
Adrianht commented 2020-09-07 14:23:56 +00:00 (Migrated from github.com)
Review

fixed

fixed
}
})
.then(resp => resp.json())
KevinMidboe commented 2020-09-07 14:00:35 +00:00 (Migrated from github.com)
Review

Is this used?

Is this used?
KevinMidboe commented 2020-09-07 14:00:35 +00:00 (Migrated from github.com)
Review

Is this used?

Is this used?
Adrianht commented 2020-09-07 14:23:56 +00:00 (Migrated from github.com)
Review

fixed

fixed
Adrianht commented 2020-09-07 14:23:56 +00:00 (Migrated from github.com)
Review

fixed

fixed

View File

@@ -6,5 +6,6 @@ module.exports = {
date: 5,
hours: 15,
apiUrl: undefined,
gatewayToken: undefined
};
gatewayToken: undefined,
vinmonopoletToken: undefined
};

13
schemas/RequestedWine.js Normal file
View File

@@ -0,0 +1,13 @@
const mongoose = require("mongoose");
const Schema = mongoose.Schema;
const RequestedWine = new Schema({
count: Number,
wineId: String,
wine: {
type: Schema.Types.ObjectId,
ref: "Wine"
}
});
module.exports = mongoose.model("RequestedWine", RequestedWine);