Skip to content

Commit

Permalink
tested a different implementation of canteen rating tags
Browse files Browse the repository at this point in the history
  • Loading branch information
CommanderStorm committed Aug 23, 2024
1 parent a9e072c commit 0be95e2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
14 changes: 7 additions & 7 deletions server/backend/migration/20220713000000.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ func (n *InitialCafeteriaRating) TableName() string {

// InitialCafeteriaRatingTag struct is a row record of the either the dish_tag_rating-table or the cafeteria_rating_tags-table in the database
type InitialCafeteriaRatingTag struct {
CafeteriaRatingTag int64 `gorm:"primary_key;AUTO_INCREMENT;column:CafeteriaRatingTag;type:int;not null;" json:"CanteenRatingTag" `
CorrespondingRating int64 `gorm:"foreignKey:cafeteriaRatingID;column:correspondingRating;type:int;not null;" json:"correspondingRating"`
Points int32 `gorm:"column:points;type:int;not null;" json:"points"`
TagID int64 `gorm:"foreignKey:cafeteriaRatingTagOption;column:tagID;type:int;not null;" json:"tagID"`
CafeteriaRatingTag int64 `gorm:"primary_key;AUTO_INCREMENT;column:CafeteriaRatingTag;type:int;not null;"`
CorrespondingRating int64 `gorm:"foreignKey:cafeteriaRatingID;column:correspondingRating;type:int;not null;"`
Points int32 `gorm:"column:points;type:int;not null;"`
TagID int64 `gorm:"foreignKey:cafeteriaRatingTagOption;column:tagID;type:int;not null;"`
}

// TableName sets the insert table name for this struct type
Expand All @@ -52,9 +52,9 @@ func (n *InitialCafeteriaRatingTag) TableName() string {

// InitialCafeteriaRatingTagOption stores all available options for tags which can be used to quickly rate cafeterias
type InitialCafeteriaRatingTagOption struct {
CafeteriaRatingsTagOption int64 `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"`
CafeteriaRatingsTagOption int64 `gorm:"primary_key;AUTO_INCREMENT;column:cafeteriaRatingTagOption;type:int;not null;"`
DE string `gorm:"column:DE;text;default:('de');not null;"`
EN string `gorm:"column:EN;text;default:('en');not null;"`
}

// TableName sets the insert table name for this struct type
Expand Down
12 changes: 7 additions & 5 deletions server/model/canteen_rating_tag.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package model

// CanteenRatingTag struct is a row record of the either the dish_tag_ratings-table or the cafeteria_rating_tags-table in the database
// CanteenRatingTag connects Canteens with ratings
type CanteenRatingTag struct {
CafeteriaRatingTag int64 `gorm:"primary_key;AUTO_INCREMENT;column:CanteenRatingTag;type:int;not null;" json:"CanteenRatingTag" `
CorrespondingRating int64 `gorm:"foreignKey:cafeteriaRatingID;column:correspondingRating;type:int;not null;" json:"correspondingRating"`
Points int32 `gorm:"column:points;type:int;not null;" json:"points"`
TagID int64 `gorm:"foreignKey:cafeteriaRatingTagOption;column:tagID;type:int;not null;" json:"tagID"`
CanteenRatingTag int64 `gorm:"primary_key;AUTO_INCREMENT;column:CafeteriaRatingTag"`
CorrespondingRatingID int64
CorrespondingRating CanteenRating
TagID int64
Tag CanteenRatingTagOption
Points int32
}

0 comments on commit 0be95e2

Please sign in to comment.