Wine models now have extra year field.

This commit is contained in:
2021-01-26 22:52:11 +01:00
parent 1b1a99ccc3
commit ac829052b6
4 changed files with 5 additions and 0 deletions

View File

@@ -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,

View File

@@ -6,6 +6,7 @@ const PreLotteryWine = new Schema({
vivinoLink: String,
rating: Number,
id: String,
year: Number,
image: String,
price: String,
country: String

View File

@@ -7,6 +7,7 @@ const Wine = new Schema({
rating: Number,
occurences: Number,
id: String,
year: Number,
image: String,
price: String,
country: String

View File

@@ -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