From ac829052b628034a1af016d80d52bd35ae116a96 Mon Sep 17 00:00:00 2001 From: KevinMidboe Date: Tue, 26 Jan 2021 22:52:11 +0100 Subject: [PATCH] Wine models now have extra year field. --- api/prelotteryWine.js | 2 ++ api/schemas/PreLotteryWine.js | 1 + api/schemas/Wine.js | 1 + api/vinmonopolet.js | 1 + 4 files changed, 5 insertions(+) diff --git a/api/prelotteryWine.js b/api/prelotteryWine.js index c5003e3..453c10f 100644 --- a/api/prelotteryWine.js +++ b/api/prelotteryWine.js @@ -13,6 +13,7 @@ const addWines = wines => { name: wine.name, vivinoLink: wine.vivinoLink, rating: wine.rating, + year: wine.year, image: wine.image, price: wine.price, country: wine.country, @@ -44,6 +45,7 @@ const updateWineById = (id, updateModel) => { name: updateModel.name != null ? updateModel.name : wine.name, vivinoLink: updateModel.vivinoLink != null ? updateModel.vivinoLink : wine.vivinoLink, rating: updateModel.rating != null ? updateModel.rating : wine.rating, + year: updateModel.year != null ? updateModel.year : wine.year, image: updateModel.image != null ? updateModel.image : wine.image, price: updateModel.price != null ? updateModel.price : wine.price, country: updateModel.country != null ? updateModel.country : wine.country, diff --git a/api/schemas/PreLotteryWine.js b/api/schemas/PreLotteryWine.js index 69295b5..7ff3ad4 100644 --- a/api/schemas/PreLotteryWine.js +++ b/api/schemas/PreLotteryWine.js @@ -6,6 +6,7 @@ const PreLotteryWine = new Schema({ vivinoLink: String, rating: Number, id: String, + year: Number, image: String, price: String, country: String diff --git a/api/schemas/Wine.js b/api/schemas/Wine.js index a24fc83..c4c89f6 100644 --- a/api/schemas/Wine.js +++ b/api/schemas/Wine.js @@ -7,6 +7,7 @@ const Wine = new Schema({ rating: Number, occurences: Number, id: String, + year: Number, image: String, price: String, country: String diff --git a/api/vinmonopolet.js b/api/vinmonopolet.js index 15d40c2..164e09f 100644 --- a/api/vinmonopolet.js +++ b/api/vinmonopolet.js @@ -10,6 +10,7 @@ const convertToOurWineObject = wine => { rating: wine.basic.alcoholContent, occurences: 0, id: wine.basic.productId, + year: wine.basic.vintage, image: `https://bilder.vinmonopolet.no/cache/500x500-0/${wine.basic.productId}-1.jpg`, price: wine.prices[0].salesPrice.toString(), country: wine.origins.origin.country