🍷
This commit is contained in:
@@ -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())
|
||||
|
||||
5
config/env/lottery.config.example.js
vendored
5
config/env/lottery.config.example.js
vendored
@@ -6,5 +6,6 @@ module.exports = {
|
||||
date: 5,
|
||||
hours: 15,
|
||||
apiUrl: undefined,
|
||||
gatewayToken: undefined
|
||||
};
|
||||
gatewayToken: undefined,
|
||||
vinmonopoletToken: undefined
|
||||
};
|
||||
13
schemas/RequestedWine.js
Normal file
13
schemas/RequestedWine.js
Normal 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);
|
||||
Reference in New Issue
Block a user