This commit is contained in:
Adrian Thompson
2020-08-28 17:20:37 +02:00
parent 7b7895728b
commit aea808dae1
3 changed files with 18 additions and 4 deletions

View File

@@ -2,7 +2,7 @@ const express = require("express");
const path = require("path");
const router = express.Router();
const fetch = require('node-fetch')
const config = require(path.join(__dirname + "/../config/env/vinmonopolet.config"));
const config = require(path.join(__dirname + "/../config/env/lottery.config"));
const mustBeAuthenticated = require(path.join(__dirname + "/../middleware/mustBeAuthenticated"))
@@ -32,7 +32,7 @@ router.route("/wineinfo/search").get(async (req, res) => {
const vinmonopoletResponse = await fetch(url, {
headers: {
"Ocp-Apim-Subscription-Key": `${config.gatewayToken}`
"Ocp-Apim-Subscription-Key": config.vinmonopoletToken
}
})
.then(resp => resp.json())

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);