From 2cb858abea99772e9e997e6934e98e39bcb8ec45 Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Thu, 31 Aug 2023 01:23:41 +0200 Subject: [PATCH] fixed the exported json sometimes having the wrong content --- server/model/cafeteria.go | 2 +- server/model/cafeteriaRating.go | 4 ++-- server/model/cafeteriaRatingAverage.go | 4 ++-- server/model/cafeteriaRatingTag.go | 2 +- server/model/cafeteriaRatingTagAverage.go | 6 +++--- server/model/cafeteriaRatingTagOptions.go | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/server/model/cafeteria.go b/server/model/cafeteria.go index 7a5988e5..12697ddf 100644 --- a/server/model/cafeteria.go +++ b/server/model/cafeteria.go @@ -2,7 +2,7 @@ package model // Cafeteria stores all Available cafeterias in the format of the eat-api type Cafeteria struct { - Cafeteria int32 `gorm:"primary_key;AUTO_INCREMENT;column:cafeteria;type:int;not null;" json:"cafeteria" ` + Cafeteria int32 `gorm:"primary_key;AUTO_INCREMENT;column:cafeteria;type:int;not null;" json:"canteen" ` Name string `gorm:"column:name;type:mediumtext;not null;" json:"name" ` Address string `gorm:"column:address;type:text;not null;" json:"address" ` Latitude float32 `gorm:"column:latitude;type:float;not null;" json:"latitude" ` diff --git a/server/model/cafeteriaRating.go b/server/model/cafeteriaRating.go index 1916d6b4..d8f2f8d0 100644 --- a/server/model/cafeteriaRating.go +++ b/server/model/cafeteriaRating.go @@ -6,10 +6,10 @@ import ( // CafeteriaRating stores all Available cafeterias in the format of the eat-api type CafeteriaRating struct { - CafeteriaRating int32 `gorm:"primary_key;AUTO_INCREMENT;column:cafeteriaRating;type:int;not null;" json:"cafeteriarating"` + CafeteriaRating int32 `gorm:"primary_key;AUTO_INCREMENT;column:cafeteriaRating;type:int;not null;" json:"canteenrating"` Points int32 `gorm:"column:points;type:int;not null;" json:"points"` Comment string `gorm:"column:comment;type:text;" json:"comment" ` - CafeteriaID int32 `gorm:"column:cafeteriaID;foreignKey:cafeteria;type:int;not null;" json:"cafeteriaID"` + CafeteriaID int32 `gorm:"column:cafeteriaID;foreignKey:cafeteria;type:int;not null;" json:"canteenID"` Timestamp time.Time `gorm:"column:timestamp;type:timestamp;not null;" json:"timestamp" ` Image string `gorm:"column:image;type:text;" json:"image"` } diff --git a/server/model/cafeteriaRatingAverage.go b/server/model/cafeteriaRatingAverage.go index 98c5401c..821f915c 100644 --- a/server/model/cafeteriaRatingAverage.go +++ b/server/model/cafeteriaRatingAverage.go @@ -2,8 +2,8 @@ package model // CafeteriaRatingAverage stores all precomputed values for the cafeteria ratings type CafeteriaRatingAverage struct { - CafeteriaRatingAverage int32 `gorm:"primary_key;AUTO_INCREMENT;column:cafeteriaRatingAverage;type:int;not null;" json:"cafeteriaRatingAverage" ` - CafeteriaID int32 `gorm:"column:cafeteriaID;foreignKey:cafeteria;type:int;not null;" json:"cafeteriaID"` + CafeteriaRatingAverage int32 `gorm:"primary_key;AUTO_INCREMENT;column:cafeteriaRatingAverage;type:int;not null;" json:"canteenRatingAverage" ` + CafeteriaID int32 `gorm:"column:cafeteriaID;foreignKey:cafeteria;type:int;not null;" json:"canteenID"` Average float32 `gorm:"column:average;type:float;not null;" json:"average" ` Min int8 `gorm:"column:min;type:int;not null;" json:"min"` Max int8 `gorm:"column:max;type:int;not null;" json:"max"` diff --git a/server/model/cafeteriaRatingTag.go b/server/model/cafeteriaRatingTag.go index d266d776..1abe02ed 100644 --- a/server/model/cafeteriaRatingTag.go +++ b/server/model/cafeteriaRatingTag.go @@ -2,7 +2,7 @@ package model // CafeteriaRatingTag struct is a row record of the either the dish_tag_rating-table or the cafeteria_rating_tags-table in the database type CafeteriaRatingTag struct { - CafeteriaRatingTag int32 `gorm:"primary_key;AUTO_INCREMENT;column:CafeteriaRatingTag;type:int;not null;" json:"CafeteriaRatingTag" ` + CafeteriaRatingTag int32 `gorm:"primary_key;AUTO_INCREMENT;column:CafeteriaRatingTag;type:int;not null;" json:"CanteenRatingTag" ` CorrespondingRating int32 `gorm:"foreignKey:cafeteriaRatingID;column:correspondingRating;type:int;not null;" json:"correspondingRating"` Points int32 `gorm:"column:points;type:int;not null;" json:"points"` TagID int `gorm:"foreignKey:cafeteriaRatingTagOption;column:tagID;type:int;not null;" json:"tagID"` diff --git a/server/model/cafeteriaRatingTagAverage.go b/server/model/cafeteriaRatingTagAverage.go index 56491327..d69b8db3 100644 --- a/server/model/cafeteriaRatingTagAverage.go +++ b/server/model/cafeteriaRatingTagAverage.go @@ -2,10 +2,10 @@ package model // CafeteriaRatingTagsAverage stores all precomputed values for the cafeteria ratings type CafeteriaRatingTagsAverage struct { - CafeteriaRatingTagsAverage int32 `gorm:"primary_key;AUTO_INCREMENT;column:cafeteriaRatingTagsAverage;type:int;not null;" json:"cafeteriaRatingTagsAverage" ` - CafeteriaID int32 `gorm:"column:cafeteriaID;foreignKey:cafeteria;type:int;not null;" json:"cafeteriaID"` + CafeteriaRatingTagsAverage int32 `gorm:"primary_key;AUTO_INCREMENT;column:cafeteriaRatingTagsAverage;type:int;not null;" json:"canteenRatingTagsAverage"` + CafeteriaID int32 `gorm:"column:cafeteriaID;foreignKey:cafeteria;type:int;not null;" json:"canteenID"` TagID int32 `gorm:"column:tagID;foreignKey:cafeteriaRatingTagOption;type:int;not null;" json:"tagID"` - Average float32 `gorm:"column:average;type:float;not null;" json:"average" ` + Average float32 `gorm:"column:average;type:float;not null;" json:"average"` Min int8 `gorm:"column:min;type:int;not null;" json:"min"` Max int8 `gorm:"column:max;type:int;not null;" json:"max"` Std float32 `gorm:"column:std;type:float;not null;" json:"std"` diff --git a/server/model/cafeteriaRatingTagOptions.go b/server/model/cafeteriaRatingTagOptions.go index 0760ec34..e2388a1e 100644 --- a/server/model/cafeteriaRatingTagOptions.go +++ b/server/model/cafeteriaRatingTagOptions.go @@ -2,7 +2,7 @@ package model // CafeteriaRatingTagOption stores all available options for tags which can be used to quickly rate cafeterias type CafeteriaRatingTagOption struct { - CafeteriaRatingsTagOption int32 `gorm:"primary_key;AUTO_INCREMENT;column:cafeteriaRatingTagOption;type:int;not null;" json:"cafeteriaRatingTagOption"` + CafeteriaRatingsTagOption int32 `gorm:"primary_key;AUTO_INCREMENT;column:cafeteriaRatingTagOption;type:int;not null;" json:"canteenRatingTagOption"` DE string `gorm:"column:DE;text;default:de;not null;" json:"DE"` EN string `gorm:"column:EN;text;default:en;not null;" json:"EN"` }