From f65d4ec82cea5c942f32928d86ab73cbc845de7f Mon Sep 17 00:00:00 2001 From: Frank Elsinga <frank@elsinga.de> Date: Tue, 19 Sep 2023 17:34:08 +0200 Subject: [PATCH] chore:fixed us unnessesarily truncating our id fields (#234) * fixed us unnessesarily truncating our id fields * fixed compilation errors --- server/api/tumdev/campus_backend.pb.go | 24 +++++++-------- server/api/tumdev/campus_backend.pb.gw.go | 4 +-- server/api/tumdev/campus_backend.proto | 8 ++--- server/api/tumdev/campus_backend.swagger.json | 16 +++++----- .../backend/cafeteriaRatingDBInitializer.go | 6 ++-- server/backend/cafeteriaService.go | 30 +++++++++---------- server/backend/cron/canteenHeadCount.go | 2 +- server/backend/cron/dishNameDownload.go | 14 ++++----- server/backend/cron/news.go | 4 +-- server/backend/news_test.go | 4 +-- server/model/cafeteria.go | 2 +- server/model/cafeteriaRating.go | 4 +-- server/model/cafeteriaRatingAverage.go | 12 ++++---- server/model/cafeteriaRatingTag.go | 6 ++-- server/model/cafeteriaRatingTagAverage.go | 6 ++-- server/model/cafeteriaRatingTagOptions.go | 2 +- server/model/crontab.go | 2 +- server/model/devices.go | 2 +- server/model/dish.go | 4 +-- server/model/dishNameTag.go | 6 ++-- server/model/dishNameTagAverage.go | 6 ++-- server/model/dishNameTagOption.go | 2 +- server/model/dishNameTagOptionExcluded.go | 4 +-- server/model/dishNameTagOptionIncluded.go | 4 +-- server/model/dishRating.go | 6 ++-- server/model/dishRatingAverage.go | 14 ++++----- server/model/dishRatingTag.go | 6 ++-- server/model/dishRatingTagAverage.go | 8 ++--- server/model/dishRatingTagOption.go | 2 +- server/model/dishToDishNameTags.go | 6 ++-- server/model/dishesOfTheWeek.go | 4 +-- server/model/files.go | 2 +- server/model/iosScheduledUpdateLog.go | 2 +- server/model/iosSchedulingPriority.go | 12 ++++---- server/model/ios_grade.go | 2 +- server/model/news.go | 4 +-- server/model/news_alert.go | 4 +-- server/model/news_source.go | 4 +-- server/model/notification.go | 2 +- server/model/notification_confirmation.go | 4 +-- server/model/notification_type.go | 2 +- server/model/roomfinder_building2area.go | 2 +- server/model/roomfinder_buildings2maps.go | 2 +- server/model/roomfinder_maps.go | 2 +- server/model/roomfinder_rooms.go | 2 +- server/model/roomfinder_rooms2maps.go | 4 +-- server/model/updateNote.go | 2 +- 47 files changed, 136 insertions(+), 136 deletions(-) diff --git a/server/api/tumdev/campus_backend.pb.go b/server/api/tumdev/campus_backend.pb.go index c4145f50..032b8c70 100644 --- a/server/api/tumdev/campus_backend.pb.go +++ b/server/api/tumdev/campus_backend.pb.go @@ -485,7 +485,7 @@ type Room struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - RoomId int32 `protobuf:"varint,1,opt,name=room_id,json=roomId,proto3" json:"room_id,omitempty"` + RoomId int64 `protobuf:"varint,1,opt,name=room_id,json=roomId,proto3" json:"room_id,omitempty"` RoomCode string `protobuf:"bytes,2,opt,name=room_code,json=roomCode,proto3" json:"room_code,omitempty"` BuildingNr string `protobuf:"bytes,3,opt,name=building_nr,json=buildingNr,proto3" json:"building_nr,omitempty"` ArchId string `protobuf:"bytes,4,opt,name=arch_id,json=archId,proto3" json:"arch_id,omitempty"` @@ -528,7 +528,7 @@ func (*Room) Descriptor() ([]byte, []int) { return file_tumdev_campus_backend_proto_rawDescGZIP(), []int{8} } -func (x *Room) GetRoomId() int32 { +func (x *Room) GetRoomId() int64 { if x != nil { return x.RoomId } @@ -596,7 +596,7 @@ type NewsItem struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"` Text string `protobuf:"bytes,3,opt,name=text,proto3" json:"text,omitempty"` Link string `protobuf:"bytes,4,opt,name=link,proto3" json:"link,omitempty"` @@ -637,7 +637,7 @@ func (*NewsItem) Descriptor() ([]byte, []int) { return file_tumdev_campus_backend_proto_rawDescGZIP(), []int{9} } -func (x *NewsItem) GetId() int32 { +func (x *NewsItem) GetId() int64 { if x != nil { return x.Id } @@ -2052,7 +2052,7 @@ type RatingTag struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - TagId int32 `protobuf:"varint,1,opt,name=tag_id,json=tagId,proto3" json:"tag_id,omitempty"` + TagId int64 `protobuf:"varint,1,opt,name=tag_id,json=tagId,proto3" json:"tag_id,omitempty"` Points float64 `protobuf:"fixed64,2,opt,name=points,proto3" json:"points,omitempty"` } @@ -2088,7 +2088,7 @@ func (*RatingTag) Descriptor() ([]byte, []int) { return file_tumdev_campus_backend_proto_rawDescGZIP(), []int{33} } -func (x *RatingTag) GetTagId() int32 { +func (x *RatingTag) GetTagId() int64 { if x != nil { return x.TagId } @@ -3099,7 +3099,7 @@ type GetUpdateNoteRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Version int32 `protobuf:"varint,1,opt,name=version,proto3" json:"version,omitempty"` + Version int64 `protobuf:"varint,1,opt,name=version,proto3" json:"version,omitempty"` } func (x *GetUpdateNoteRequest) Reset() { @@ -3134,7 +3134,7 @@ func (*GetUpdateNoteRequest) Descriptor() ([]byte, []int) { return file_tumdev_campus_backend_proto_rawDescGZIP(), []int{50} } -func (x *GetUpdateNoteRequest) GetVersion() int32 { +func (x *GetUpdateNoteRequest) GetVersion() int64 { if x != nil { return x.Version } @@ -4633,7 +4633,7 @@ var file_tumdev_campus_backend_proto_rawDesc = []byte{ 0x12, 0x1f, 0x0a, 0x05, 0x72, 0x6f, 0x6f, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x6f, 0x6f, 0x6d, 0x52, 0x05, 0x72, 0x6f, 0x6f, 0x6d, 0x73, 0x22, 0xea, 0x01, 0x0a, 0x04, 0x52, 0x6f, 0x6f, 0x6d, 0x12, 0x17, 0x0a, 0x07, 0x72, 0x6f, - 0x6f, 0x6d, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x72, 0x6f, 0x6f, + 0x6f, 0x6d, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x72, 0x6f, 0x6f, 0x6d, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x72, 0x6f, 0x6f, 0x6d, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x6f, 0x6f, 0x6d, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x6e, 0x72, 0x18, @@ -4648,7 +4648,7 @@ var file_tumdev_campus_backend_proto_rawDesc = []byte{ 0x28, 0x09, 0x52, 0x06, 0x63, 0x61, 0x6d, 0x70, 0x75, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0xc3, 0x01, 0x0a, 0x08, 0x4e, 0x65, 0x77, 0x73, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x0e, 0x0a, 0x02, 0x69, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x74, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, 0x78, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x04, 0x20, @@ -4810,7 +4810,7 @@ var file_tumdev_campus_backend_proto_rawDesc = []byte{ 0x28, 0x09, 0x52, 0x02, 0x64, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x65, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x65, 0x6e, 0x22, 0x3a, 0x0a, 0x09, 0x52, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x54, 0x61, 0x67, 0x12, 0x15, 0x0a, 0x06, 0x74, 0x61, 0x67, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x05, 0x74, 0x61, 0x67, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x6f, + 0x01, 0x28, 0x03, 0x52, 0x05, 0x74, 0x61, 0x67, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x06, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x22, 0x44, 0x0a, 0x13, 0x52, 0x61, 0x74, 0x69, 0x6e, 0x67, 0x54, 0x61, 0x67, 0x4e, 0x65, 0x77, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x15, 0x0a, 0x06, 0x74, 0x61, 0x67, @@ -4922,7 +4922,7 @@ var file_tumdev_campus_backend_proto_rawDesc = []byte{ 0x01, 0x28, 0x05, 0x52, 0x0b, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x49, 0x64, 0x22, 0x30, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, + 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x51, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4e, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, diff --git a/server/api/tumdev/campus_backend.pb.gw.go b/server/api/tumdev/campus_backend.pb.gw.go index 1fec6e98..2ef9b4b2 100644 --- a/server/api/tumdev/campus_backend.pb.gw.go +++ b/server/api/tumdev/campus_backend.pb.gw.go @@ -519,7 +519,7 @@ func request_Campus_GetUpdateNote_0(ctx context.Context, marshaler runtime.Marsh return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "version") } - protoReq.Version, err = runtime.Int32(val) + protoReq.Version, err = runtime.Int64(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "version", err) } @@ -545,7 +545,7 @@ func local_request_Campus_GetUpdateNote_0(ctx context.Context, marshaler runtime return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "version") } - protoReq.Version, err = runtime.Int32(val) + protoReq.Version, err = runtime.Int64(val) if err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "version", err) } diff --git a/server/api/tumdev/campus_backend.proto b/server/api/tumdev/campus_backend.proto index 4e814246..c30bf622 100644 --- a/server/api/tumdev/campus_backend.proto +++ b/server/api/tumdev/campus_backend.proto @@ -219,7 +219,7 @@ message SearchRoomsReply { } message Room { - int32 room_id = 1; + int64 room_id = 1; string room_code = 2; string building_nr = 3; string arch_id = 4; @@ -231,7 +231,7 @@ message Room { } message NewsItem { - int32 id = 1; + int64 id = 1; string title = 2; string text = 3; string link = 4; @@ -377,7 +377,7 @@ message TagsOverview { } message RatingTag { - int32 tag_id = 1; + int64 tag_id = 1; double points = 2; } @@ -478,7 +478,7 @@ message OpeningTimesMsgElement { } message GetUpdateNoteRequest { - int32 version = 1; + int64 version = 1; } message GetUpdateNoteReply { diff --git a/server/api/tumdev/campus_backend.swagger.json b/server/api/tumdev/campus_backend.swagger.json index 4da1f3ff..4242e82b 100644 --- a/server/api/tumdev/campus_backend.swagger.json +++ b/server/api/tumdev/campus_backend.swagger.json @@ -966,8 +966,8 @@ "name": "version", "in": "path", "required": true, - "type": "integer", - "format": "int32" + "type": "string", + "format": "int64" } ], "tags": [ @@ -1565,8 +1565,8 @@ "type": "object", "properties": { "id": { - "type": "integer", - "format": "int32" + "type": "string", + "format": "int64" }, "title": { "type": "string" @@ -1647,8 +1647,8 @@ "type": "object", "properties": { "tagId": { - "type": "integer", - "format": "int32" + "type": "string", + "format": "int64" }, "points": { "type": "number", @@ -1748,8 +1748,8 @@ "type": "object", "properties": { "roomId": { - "type": "integer", - "format": "int32" + "type": "string", + "format": "int64" }, "roomCode": { "type": "string" diff --git a/server/backend/cafeteriaRatingDBInitializer.go b/server/backend/cafeteriaRatingDBInitializer.go index c4879559..3a0eade6 100644 --- a/server/backend/cafeteriaRatingDBInitializer.go +++ b/server/backend/cafeteriaRatingDBInitializer.go @@ -73,7 +73,7 @@ Old tags won't be removed to prevent problems with foreign keys. func updateNameTagOptions(db *gorm.DB) { tagsNames := generateNameTagListFromFile("static_data/dishNameTags.json") for _, v := range tagsNames.MultiLanguageNameTags { - var parentId int32 + var parentId int64 res := db.Model(&model.DishNameTagOption{}). Where("EN LIKE ? AND DE LIKE ?", v.TagNameEnglish, v.TagNameGerman). Select("DishNameTagOption"). @@ -99,7 +99,7 @@ func updateNameTagOptions(db *gorm.DB) { } } -func addNotIncluded(parentId int32, db *gorm.DB, v nameTag) { +func addNotIncluded(parentId int64, db *gorm.DB, v nameTag) { var count int64 for _, expression := range v.NotIncluded { fields := log.Fields{"expression": expression, "parentId": parentId} @@ -123,7 +123,7 @@ func addNotIncluded(parentId int32, db *gorm.DB, v nameTag) { } } -func addCanBeIncluded(parentId int32, db *gorm.DB, v nameTag) { +func addCanBeIncluded(parentId int64, db *gorm.DB, v nameTag) { var count int64 for _, expression := range v.CanBeIncluded { fields := log.Fields{"expression": expression, "parentId": parentId} diff --git a/server/backend/cafeteriaService.go b/server/backend/cafeteriaService.go index 6fd7bead..cf4d6e1f 100644 --- a/server/backend/cafeteriaService.go +++ b/server/backend/cafeteriaService.go @@ -58,10 +58,10 @@ func (s *CampusServer) GetCafeteriaRatings(_ context.Context, input *pb.GetCante cafeteriaTags := queryTags(s.db, cafeteriaId, -1, CAFETERIA) return &pb.GetCanteenRatingsReply{ - Avg: float64(result.Average), - Std: float64(result.Std), - Min: int32(result.Min), - Max: int32(result.Max), + Avg: result.Average, + Std: result.Std, + Min: result.Min, + Max: result.Max, Rating: ratings, RatingTags: cafeteriaTags, }, nil @@ -166,10 +166,10 @@ func (s *CampusServer) GetDishRatings(_ context.Context, input *pb.GetDishRating nameTags := queryTags(s.db, cafeteriaID, dishID, NAME) return &pb.GetDishRatingsReply{ - Avg: float64(result.Average), - Std: float64(result.Std), - Min: int32(result.Min), - Max: int32(result.Max), + Avg: result.Average, + Std: result.Std, + Min: result.Min, + Max: result.Max, Rating: ratings, RatingTags: dishTags, NameTags: nameTags, @@ -331,7 +331,7 @@ func queryTags(db *gorm.DB, cafeteriaID int32, dishID int32, ratingType modelTyp // queryTagRatingOverviewForRating // Query all rating tags which belong to a specific rating given with an ID and return it as TagRatingOverviews -func queryTagRatingsOverviewForRating(s *CampusServer, dishID int32, ratingType modelType) []*pb.RatingTagNewRequest { +func queryTagRatingsOverviewForRating(s *CampusServer, dishID int64, ratingType modelType) []*pb.RatingTagNewRequest { var results []*pb.RatingTagNewRequest var err error if ratingType == DISH { @@ -383,7 +383,7 @@ func (s *CampusServer) NewCanteenRating(_ context.Context, input *pb.NewCanteenR return &pb.NewCanteenRatingReply{}, nil } -func imageWrapper(image []byte, path string, id int32) string { +func imageWrapper(image []byte, path string, id int64) string { var resPath = "" if len(image) > 0 { var resError error @@ -484,8 +484,8 @@ func (s *CampusServer) NewDishRating(_ context.Context, input *pb.NewDishRatingR // assignDishNameTag // Query all name tags for this specific dish and generate the DishNameTag Ratings ffor each name tag -func assignDishNameTag(s *CampusServer, rating model.DishRating, dishID int32) { - var result []int +func assignDishNameTag(s *CampusServer, rating model.DishRating, dishID int64) { + var result []int64 err := s.db.Model(&model.DishToDishNameTag{}). Where("dishID = ? ", dishID). Select("nameTagID"). @@ -508,7 +508,7 @@ func assignDishNameTag(s *CampusServer, rating model.DishRating, dishID int32) { // inputSanitizationForNewRatingElements Checks parameters of the new rating for all cafeteria and dish ratings. // Additionally, queries the cafeteria ID, since it checks whether the cafeteria actually exists. -func inputSanitizationForNewRatingElements(rating int32, comment string, cafeteriaName string, s *CampusServer) (int32, error) { +func inputSanitizationForNewRatingElements(rating int32, comment string, cafeteriaName string, s *CampusServer) (int64, error) { if rating > 5 || rating < 0 { return -1, status.Error(codes.InvalidArgument, "Rating must be a positive number not larger than 10. Rating has not been saved.") } @@ -536,7 +536,7 @@ func inputSanitizationForNewRatingElements(rating int32, comment string, cafeter // storeRatingTags // Checks whether the rating-tag name is a valid option and if so, // it will be saved with a reference to the rating -func storeRatingTags(s *CampusServer, parentRatingID int32, tags []*pb.RatingTag, tagType modelType) error { +func storeRatingTags(s *CampusServer, parentRatingID int64, tags []*pb.RatingTag, tagType modelType) error { var errorOccurred = "" var warningOccurred = "" if len(tags) > 0 { @@ -569,7 +569,7 @@ func storeRatingTags(s *CampusServer, parentRatingID int32, tags []*pb.RatingTag Create(&model.DishRatingTag{ CorrespondingRating: parentRatingID, Points: int32(currentTag.Points), - TagID: int(currentTag.TagId), + TagID: currentTag.TagId, }).Error if err != nil { log.WithError(err).Error("while Creating a currentTag rating for a new rating.") diff --git a/server/backend/cron/canteenHeadCount.go b/server/backend/cron/canteenHeadCount.go index 1eecc9c2..23892602 100644 --- a/server/backend/cron/canteenHeadCount.go +++ b/server/backend/cron/canteenHeadCount.go @@ -163,7 +163,7 @@ func sumApCounts(aps []AccessPoint) uint32 { log.WithError(err).Error("Canteen HeadCount getting the count failed for access point: ", ap.Target) continue } - total += uint32(count) + total += count } return total } diff --git a/server/backend/cron/dishNameDownload.go b/server/backend/cron/dishNameDownload.go index 5db223e7..b51e1627 100644 --- a/server/backend/cron/dishNameDownload.go +++ b/server/backend/cron/dishNameDownload.go @@ -19,7 +19,7 @@ type cafeteriaName struct { type cafeteriaWithID struct { Name string `json:"name"` - Cafeteria int32 `json:"cafeteria"` + Cafeteria int64 `json:"cafeteria"` } type location struct { @@ -98,7 +98,7 @@ func downloadDailyDishes(c *CronService) { } var count int64 - var dishId int32 + var dishId int64 errCount := c.db.Model(&model.Dish{}). Where("name = ? AND cafeteriaID = ?", dish.Name, dish.CafeteriaID). Select("dish").First(&dishId). @@ -176,9 +176,9 @@ func downloadCanteenNames(c *CronService) { // addDishTagsToMapping // Checks whether the dish name includes one of the expressions for the excluded tags as well as the included tags. // The corresponding tags for all identified DishNames will be saved in the table DishNameTags. -func addDishTagsToMapping(dishID int32, dishName string, db *gorm.DB) { +func addDishTagsToMapping(dishID int64, dishName string, db *gorm.DB) { lowercaseDish := strings.ToLower(dishName) - var includedTags []int32 + var includedTags []int64 errIncluded := db.Model(&model.DishNameTagOptionIncluded{}). Where("? LIKE CONCAT('%', expression ,'%')", lowercaseDish). Select("nameTagID"). @@ -187,7 +187,7 @@ func addDishTagsToMapping(dishID int32, dishName string, db *gorm.DB) { log.WithError(errIncluded).Error("Error while querying all included expressions for the dish: ", lowercaseDish) } - var excludedTags []int32 + var excludedTags []int64 errExcluded := db.Model(&model.DishNameTagOptionExcluded{}). Where("? LIKE CONCAT('%', expression ,'%')", lowercaseDish). Select("nameTagID"). @@ -219,10 +219,10 @@ func addDishTagsToMapping(dishID int32, dishName string, db *gorm.DB) { } } } -func contains(s []int32, e int32) int32 { +func contains(s []int64, e int64) int64 { for i, a := range s { if a == e { - return int32(i) + return int64(i) } } return -1 diff --git a/server/backend/cron/news.go b/server/backend/cron/news.go index 0b571995..e1f7eeb7 100644 --- a/server/backend/cron/news.go +++ b/server/backend/cron/news.go @@ -119,7 +119,7 @@ func (c *CronService) parseNewsFeed(source model.NewsSource) error { Src: source.Source, Link: item.Link, Image: enclosureUrl, - FilesID: null.IntFrom(int64(file.File)), + FilesID: null.IntFrom(file.File), Files: file, } newNews = append(newNews, newsItem) @@ -177,7 +177,7 @@ func skipNews(existingLinks []string, link string) bool { return false } -func (c *CronService) cleanOldNewsForSource(source int32) error { +func (c *CronService) cleanOldNewsForSource(source int64) error { log.WithField("source", source).Trace("Truncating old entries") if res := c.db.Delete(&model.News{}, "`src` = ? AND `created` < ?", source, time.Now().Add(time.Hour*24*365*-1)); res.Error == nil { log.WithField("RowsAffected", res.RowsAffected).Info("cleaned up old news") diff --git a/server/backend/news_test.go b/server/backend/news_test.go index 628acd92..36cb8710 100644 --- a/server/backend/news_test.go +++ b/server/backend/news_test.go @@ -48,7 +48,7 @@ func (s *NewsSuite) SetupSuite() { s.deviceBuf = newDeviceBuffer() } -func file(id int32) *model.Files { +func file(id int64) *model.Files { return &model.Files{ File: id, Name: fmt.Sprintf("src_%d.png", id), @@ -107,7 +107,7 @@ func news1() *model.News { News: 1, Title: "Amazing News 1", Link: "https://example.com/amazing2", - FilesID: null.Int{NullInt64: sql.NullInt64{Int64: int64(file(1).File), Valid: true}}, + FilesID: null.Int{NullInt64: sql.NullInt64{Int64: file(1).File, Valid: true}}, Files: file(1), } } diff --git a/server/model/cafeteria.go b/server/model/cafeteria.go index 12697ddf..a5c59582 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:"canteen" ` + Cafeteria int64 `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 d8f2f8d0..cfa5f686 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:"canteenrating"` + CafeteriaRating int64 `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:"canteenID"` + CafeteriaID int64 `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 821f915c..cb624a95 100644 --- a/server/model/cafeteriaRatingAverage.go +++ b/server/model/cafeteriaRatingAverage.go @@ -2,12 +2,12 @@ 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:"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"` - Std float32 `gorm:"column:std;type:float;not null;" json:"std"` + CafeteriaRatingAverage int64 `gorm:"primary_key;AUTO_INCREMENT;column:cafeteriaRatingAverage;type:int;not null;" json:"canteenRatingAverage" ` + CafeteriaID int64 `gorm:"column:cafeteriaID;foreignKey:cafeteria;type:int;not null;" json:"canteenID"` + Average float64 `gorm:"column:average;type:float;not null;" json:"average" ` + Min int32 `gorm:"column:min;type:int;not null;" json:"min"` + Max int32 `gorm:"column:max;type:int;not null;" json:"max"` + Std float64 `gorm:"column:std;type:float;not null;" json:"std"` } // TableName sets the insert table name for this struct type diff --git a/server/model/cafeteriaRatingTag.go b/server/model/cafeteriaRatingTag.go index 1abe02ed..15e964b6 100644 --- a/server/model/cafeteriaRatingTag.go +++ b/server/model/cafeteriaRatingTag.go @@ -2,10 +2,10 @@ 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:"CanteenRatingTag" ` - CorrespondingRating int32 `gorm:"foreignKey:cafeteriaRatingID;column:correspondingRating;type:int;not null;" json:"correspondingRating"` + 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 int `gorm:"foreignKey:cafeteriaRatingTagOption;column:tagID;type:int;not null;" json:"tagID"` + TagID int64 `gorm:"foreignKey:cafeteriaRatingTagOption;column:tagID;type:int;not null;" json:"tagID"` } // TableName sets the insert table name for this struct type diff --git a/server/model/cafeteriaRatingTagAverage.go b/server/model/cafeteriaRatingTagAverage.go index d69b8db3..6c1abeb7 100644 --- a/server/model/cafeteriaRatingTagAverage.go +++ b/server/model/cafeteriaRatingTagAverage.go @@ -2,9 +2,9 @@ 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:"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"` + CafeteriaRatingTagsAverage int64 `gorm:"primary_key;AUTO_INCREMENT;column:cafeteriaRatingTagsAverage;type:int;not null;" json:"canteenRatingTagsAverage"` + CafeteriaID int64 `gorm:"column:cafeteriaID;foreignKey:cafeteria;type:int;not null;" json:"canteenID"` + TagID int64 `gorm:"column:tagID;foreignKey:cafeteriaRatingTagOption;type:int;not null;" json:"tagID"` 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/cafeteriaRatingTagOptions.go b/server/model/cafeteriaRatingTagOptions.go index e2388a1e..e5d27d49 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:"canteenRatingTagOption"` + 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"` } diff --git a/server/model/crontab.go b/server/model/crontab.go index 6e775f14..183721e3 100644 --- a/server/model/crontab.go +++ b/server/model/crontab.go @@ -11,7 +11,7 @@ func (Crontab) TableName() string { // Crontab struct is a row record of the crontab table in the tca database type Crontab struct { - Cron int32 `gorm:"primary_key;AUTO_INCREMENT;column:cron;type:int;" json:"cron"` + Cron int64 `gorm:"primary_key;AUTO_INCREMENT;column:cron;type:int;" json:"cron"` Interval int32 `gorm:"column:interval;type:int;default:7200;" json:"interval"` LastRun int32 `gorm:"column:lastRun;type:int;default:0;" json:"last_run"` Type null.String `gorm:"column:type;type:enum ('news', 'mensa', 'kino', 'roomfinder', 'alarm', 'fileDownload','dishNameDownload','averageRatingComputation', 'iosNotifications', 'iosActivityReset', 'canteenHeadCount');" json:"type"` diff --git a/server/model/devices.go b/server/model/devices.go index 213330be..205a5ae9 100755 --- a/server/model/devices.go +++ b/server/model/devices.go @@ -8,7 +8,7 @@ import ( // Devices struct is a row record of the devices table in the tca database type Devices struct { - Device int32 `gorm:"primary_key;AUTO_INCREMENT;column:device;type:int;" json:"device"` + Device int64 `gorm:"primary_key;AUTO_INCREMENT;column:device;type:int;" json:"device"` Member null.Int `gorm:"column:member;type:int;" json:"member"` UUID string `gorm:"column:uuid;type:varchar(50);" json:"uuid"` Created null.Time `gorm:"column:created;type:timestamp;" json:"created"` diff --git a/server/model/dish.go b/server/model/dish.go index cb787aad..7ab5c4d7 100644 --- a/server/model/dish.go +++ b/server/model/dish.go @@ -13,10 +13,10 @@ var ( // Dish represents one dish fin a specific cafeteria type Dish struct { - Dish int32 `gorm:"primary_key;AUTO_INCREMENT;column:dish;type:int;not null;" json:"dish"` + Dish int64 `gorm:"primary_key;AUTO_INCREMENT;column:dish;type:int;not null;" json:"dish"` Name string `gorm:"column:name;type:text;not null;" json:"name" ` Type string `gorm:"column:type;type:text;not null;" json:"type" ` - CafeteriaID int32 `gorm:"column:cafeteriaID;foreignKey:cafeteria;type:int;not null;" json:"cafeteriaID"` + CafeteriaID int64 `gorm:"column:cafeteriaID;foreignKey:cafeteria;type:int;not null;" json:"cafeteriaID"` } // TableName sets the insert table name for this struct type diff --git a/server/model/dishNameTag.go b/server/model/dishNameTag.go index f7795451..1dc52ab4 100644 --- a/server/model/dishNameTag.go +++ b/server/model/dishNameTag.go @@ -1,10 +1,10 @@ package model type DishNameTag struct { - DishNameTag int32 `gorm:"primary_key;AUTO_INCREMENT;column:DishNameTag;type:int;not null;" json:"DishNameTag"` - CorrespondingRating int32 `gorm:"foreignKey:dish;column:correspondingRating;type:int;not null;" json:"correspondingRating"` + DishNameTag int64 `gorm:"primary_key;AUTO_INCREMENT;column:DishNameTag;type:int;not null;" json:"DishNameTag"` + CorrespondingRating int64 `gorm:"foreignKey:dish;column:correspondingRating;type:int;not null;" json:"correspondingRating"` Points int32 `gorm:"column:points;type:int;not null;" json:"points"` - TagNameID int `gorm:"foreignKey:tagRatingID;column:tagNameID;type:int;not null;" json:"tagnameID"` + TagNameID int64 `gorm:"foreignKey:tagRatingID;column:tagNameID;type:int;not null;" json:"tagnameID"` } // TableName sets the insert table name for this struct type diff --git a/server/model/dishNameTagAverage.go b/server/model/dishNameTagAverage.go index 8fe17548..2ee05076 100644 --- a/server/model/dishNameTagAverage.go +++ b/server/model/dishNameTagAverage.go @@ -2,9 +2,9 @@ package model // DishNameTagAverage stores all precomputed values for the DishName ratings type DishNameTagAverage struct { - DishNameTagAverage int32 `gorm:"primary_key;AUTO_INCREMENT;column:dishNameTagAverage;type:int;not null;" json:"dishNameTagAverage" ` - CafeteriaID int32 `gorm:"column:cafeteriaID;foreignKey:cafeteria;type:int;not null;" json:"cafeteriaID"` - TagID int32 `gorm:"column:tagID;foreignKey:DishNameTagOption;type:int;not null;" json:"tagID"` + DishNameTagAverage int64 `gorm:"primary_key;AUTO_INCREMENT;column:dishNameTagAverage;type:int;not null;" json:"dishNameTagAverage" ` + CafeteriaID int64 `gorm:"column:cafeteriaID;foreignKey:cafeteria;type:int;not null;" json:"cafeteriaID"` + TagID int64 `gorm:"column:tagID;foreignKey:DishNameTagOption;type:int;not null;" json:"tagID"` 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/dishNameTagOption.go b/server/model/dishNameTagOption.go index 17a14462..143eb8a4 100644 --- a/server/model/dishNameTagOption.go +++ b/server/model/dishNameTagOption.go @@ -1,7 +1,7 @@ package model type DishNameTagOption struct { - DishNameTagOption int32 `gorm:"column:dishNameTagOption;type:int;primary_key;AUTO_INCREMENT;not null;" json:"dishNameTagOption"` + DishNameTagOption int64 `gorm:"primary_key;AUTO_INCREMENT;column:dishNameTagOption;type:int;not null;" json:"dishNameTagOption"` DE string `gorm:"column:DE;type:text;not null;" json:"DE"` EN string `gorm:"column:EN;type:text;not null;" json:"EN"` } diff --git a/server/model/dishNameTagOptionExcluded.go b/server/model/dishNameTagOptionExcluded.go index 7c8e6deb..f957ed11 100644 --- a/server/model/dishNameTagOptionExcluded.go +++ b/server/model/dishNameTagOptionExcluded.go @@ -1,8 +1,8 @@ package model type DishNameTagOptionExcluded struct { - DishNameTagOptionExcluded int32 `gorm:"primary_key;AUTO_INCREMENT;column:dishNameTagOptionExcluded;type:int;not null;" json:"dishNameTagOptionExcluded"` - NameTagID int32 `gorm:"foreignKey:dishNameTagOption;column:nameTagID;type:int;not null;" json:"nameTagID"` + DishNameTagOptionExcluded int64 `gorm:"primary_key;AUTO_INCREMENT;column:dishNameTagOptionExcluded;type:int;not null;" json:"dishNameTagOptionExcluded"` + NameTagID int64 `gorm:"foreignKey:dishNameTagOption;column:nameTagID;type:int;not null;" json:"nameTagID"` Expression string `gorm:"column:expression;type:text;" json:"expression"` } diff --git a/server/model/dishNameTagOptionIncluded.go b/server/model/dishNameTagOptionIncluded.go index 8ed262f0..ddd7683d 100644 --- a/server/model/dishNameTagOptionIncluded.go +++ b/server/model/dishNameTagOptionIncluded.go @@ -1,8 +1,8 @@ package model type DishNameTagOptionIncluded struct { - DishNameTagOptionIncluded int32 `gorm:"primary_key;AUTO_INCREMENT;column:dishNameTagOptionIncluded;type:int;not null;" json:"dishNameTagOptionIncluded"` - NameTagID int32 `gorm:"foreignKey:dishNameTagOption;column:nameTagID;type:int;not null;" json:"nameTagID"` + DishNameTagOptionIncluded int64 `gorm:"primary_key;AUTO_INCREMENT;column:dishNameTagOptionIncluded;type:int;not null;" json:"dishNameTagOptionIncluded"` + NameTagID int64 `gorm:"foreignKey:dishNameTagOption;column:nameTagID;type:int;not null;" json:"nameTagID"` Expression string `gorm:"column:expression;type:text;" json:"expression"` } diff --git a/server/model/dishRating.go b/server/model/dishRating.go index e31086f0..7b8e7f93 100644 --- a/server/model/dishRating.go +++ b/server/model/dishRating.go @@ -5,10 +5,10 @@ import ( ) type DishRating struct { - DishRating int32 `gorm:"primary_key;AUTO_INCREMENT;column:dishRating;type:int;not null;" json:"dishRating"` + DishRating int64 `gorm:"primary_key;AUTO_INCREMENT;column:dishRating;type:int;not null;" json:"dishRating"` Points int32 `gorm:"column:points;type:int;not null;" json:"points"` - CafeteriaID int32 `gorm:"column:cafeteriaID;foreignKey:cafeteria;type:int;not null;" json:"cafeteriaID"` - DishID int32 `gorm:"column:dishID;foreignKey:dish;type:int;not null;" json:"dishID"` + CafeteriaID int64 `gorm:"column:cafeteriaID;foreignKey:cafeteria;type:int;not null;" json:"cafeteriaID"` + DishID int64 `gorm:"column:dishID;foreignKey:dish;type:int;not null;" json:"dishID"` Comment string `gorm:"column:comment;type:text;" json:"comment"` 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/dishRatingAverage.go b/server/model/dishRatingAverage.go index 61ed1374..2db0571c 100644 --- a/server/model/dishRatingAverage.go +++ b/server/model/dishRatingAverage.go @@ -2,13 +2,13 @@ package model // DishRatingAverage stores all precomputed values for the cafeteria ratings type DishRatingAverage struct { - DishRatingAverage int32 `gorm:"primary_key;AUTO_INCREMENT;column:dishRatingAverage;type:int;not null;" json:"dishRatingAverage" ` - CafeteriaID int32 `gorm:"column:cafeteriaID;foreignKey:cafeteria;type:int;not null;" json:"cafeteriaID"` - DishID int32 `gorm:"column:dishID;foreignKey:dish;type:int;not null;" json:"dishID"` - 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"` + DishRatingAverage int64 `gorm:"primary_key;AUTO_INCREMENT;column:dishRatingAverage;type:int;not null;" json:"dishRatingAverage" ` + CafeteriaID int64 `gorm:"column:cafeteriaID;foreignKey:cafeteria;type:int;not null;" json:"cafeteriaID"` + DishID int64 `gorm:"column:dishID;foreignKey:dish;type:int;not null;" json:"dishID"` + Average float64 `gorm:"column:average;type:float;not null;" json:"average" ` + Min int32 `gorm:"column:min;type:int;not null;" json:"min"` + Max int32 `gorm:"column:max;type:int;not null;" json:"max"` + Std float64 `gorm:"column:std;type:float;not null;" json:"std"` } // TableName sets the insert table name for this struct type diff --git a/server/model/dishRatingTag.go b/server/model/dishRatingTag.go index d5248c3c..de2bda74 100644 --- a/server/model/dishRatingTag.go +++ b/server/model/dishRatingTag.go @@ -1,10 +1,10 @@ package model type DishRatingTag struct { - DishRatingTag int32 `gorm:"primary_key;AUTO_INCREMENT;column:dishRatingTag;type:int;not null;" json:"dishRatingTag"` - CorrespondingRating int32 `gorm:"foreignKey:cafeteriaRating;column:parentRating;type:int;not null;" json:"parentRating"` + DishRatingTag int64 `gorm:"primary_key;AUTO_INCREMENT;column:dishRatingTag;type:int;not null;" json:"dishRatingTag"` + CorrespondingRating int64 `gorm:"foreignKey:cafeteriaRating;column:parentRating;type:int;not null;" json:"parentRating"` Points int32 `gorm:"column:points;type:int;not null;" json:"points"` - TagID int `gorm:"foreignKey:dishRatingTagOption;column:tagID;type:int;not null;" json:"tagID"` + TagID int64 `gorm:"foreignKey:dishRatingTagOption;column:tagID;type:int;not null;" json:"tagID"` } // TableName sets the insert table name for this struct type diff --git a/server/model/dishRatingTagAverage.go b/server/model/dishRatingTagAverage.go index b7b1d0c7..b1535171 100644 --- a/server/model/dishRatingTagAverage.go +++ b/server/model/dishRatingTagAverage.go @@ -2,10 +2,10 @@ package model // DishRatingTagAverage stores all precomputed values for the cafeteria ratings type DishRatingTagAverage struct { - DishRatingTagsAverage int32 `gorm:"primary_key;AUTO_INCREMENT;column:dishRatingTagsAverage;type:int;not null;" json:"dishRatingTagsAverage" ` - CafeteriaID int32 `gorm:"column:cafeteriaID;foreignKey:cafeteria;type:int;not null;" json:"cafeteriaID"` - TagID int32 `gorm:"column:tagID;foreignKey:tagID;type:int;not null;" json:"tagID"` - DishID int32 `gorm:"column:dishID;foreignKey:dishID;type:int;not null;" json:"dishID"` + DishRatingTagsAverage int64 `gorm:"primary_key;AUTO_INCREMENT;column:dishRatingTagsAverage;type:int;not null;" json:"dishRatingTagsAverage" ` + CafeteriaID int64 `gorm:"column:cafeteriaID;foreignKey:cafeteria;type:int;not null;" json:"cafeteriaID"` + TagID int64 `gorm:"column:tagID;foreignKey:tagID;type:int;not null;" json:"tagID"` + DishID int64 `gorm:"column:dishID;foreignKey:dishID;type:int;not null;" json:"dishID"` 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/dishRatingTagOption.go b/server/model/dishRatingTagOption.go index c1aeb01a..c1cbece0 100644 --- a/server/model/dishRatingTagOption.go +++ b/server/model/dishRatingTagOption.go @@ -2,7 +2,7 @@ package model // DishRatingTagOption stores all available options for tags which can be used to quickly rate dishes type DishRatingTagOption struct { - DishRatingTagOption int32 `gorm:"primary_key;AUTO_INCREMENT;column:dishRatingTagOption;type:int;not null;" json:"dishRatingTagOption"` + DishRatingTagOption int64 `gorm:"primary_key;AUTO_INCREMENT;column:dishRatingTagOption;type:int;not null;" json:"dishRatingTagOption"` DE string `gorm:"column:DE;type:text;default:de;not null;" json:"DE"` EN string `gorm:"column:EN;type:text;default:en;not null;" json:"EN"` } diff --git a/server/model/dishToDishNameTags.go b/server/model/dishToDishNameTags.go index 4c40080b..279ff1c5 100644 --- a/server/model/dishToDishNameTags.go +++ b/server/model/dishToDishNameTags.go @@ -1,9 +1,9 @@ package model type DishToDishNameTag struct { - DishToDishNameTag int32 `gorm:"primary_key;AUTO_INCREMENT;column:dishToDishNameTag;type:int;not null;" json:"dishToDishNameTag"` - DishID int32 `gorm:"column:dishID;foreignKey:dish;type:int;not null;" json:"dishID"` - NameTagID int32 `gorm:"foreignKey:dishNameTagOption;column:nameTagID;type:int;not null;" json:"nameTagID"` + DishToDishNameTag int64 `gorm:"primary_key;AUTO_INCREMENT;column:dishToDishNameTag;type:int;not null;" json:"dishToDishNameTag"` + DishID int64 `gorm:"column:dishID;foreignKey:dish;type:int;not null;" json:"dishID"` + NameTagID int64 `gorm:"foreignKey:dishNameTagOption;column:nameTagID;type:int;not null;" json:"nameTagID"` } // TableName sets the insert table name for this struct type diff --git a/server/model/dishesOfTheWeek.go b/server/model/dishesOfTheWeek.go index 7aa72331..219c306d 100644 --- a/server/model/dishesOfTheWeek.go +++ b/server/model/dishesOfTheWeek.go @@ -1,11 +1,11 @@ package model type DishesOfTheWeek struct { - DishesOfTheWeek int32 `gorm:"primary_key;AUTO_INCREMENT;column:dishesOfTheWeek;type:int;not null;" json:"dishesOfTheWeek"` + DishesOfTheWeek int64 `gorm:"primary_key;AUTO_INCREMENT;column:dishesOfTheWeek;type:int;not null;" json:"dishesOfTheWeek"` Year int32 `gorm:"column:year;type:int;not null;" json:"year"` Week int32 `gorm:"column:week;type:int;not null;" json:"week"` Day int32 `gorm:"column:day;type:int;not null;" json:"day"` - DishID int32 `gorm:"column:dishID;foreignKey:dish;type:int;not null;" json:"dishID"` + DishID int64 `gorm:"column:dishID;foreignKey:dish;type:int;not null;" json:"dishID"` } // TableName sets the insert table name for this struct type diff --git a/server/model/files.go b/server/model/files.go index 7ece1387..430bb247 100644 --- a/server/model/files.go +++ b/server/model/files.go @@ -17,7 +17,7 @@ var ( // Files struct is a row record of the files table in the tca database type Files struct { - File int32 `gorm:"primary_key;AUTO_INCREMENT;column:file;type:int;" json:"file"` + File int64 `gorm:"primary_key;AUTO_INCREMENT;column:file;type:int;" json:"file"` Name string `gorm:"column:name;type:text;size:16777215;" json:"name"` Path string `gorm:"column:path;type:text;size:16777215;" json:"path"` Downloads int32 `gorm:"column:downloads;type:int;default:0;" json:"downloads"` diff --git a/server/model/iosScheduledUpdateLog.go b/server/model/iosScheduledUpdateLog.go index 0399e303..8a3c495e 100644 --- a/server/model/iosScheduledUpdateLog.go +++ b/server/model/iosScheduledUpdateLog.go @@ -12,7 +12,7 @@ const ( // IOSScheduledUpdateLog logs the last time a device was updated. type IOSScheduledUpdateLog struct { - ID uint32 `gorm:"primary_key;auto_increment;not_null" json:"id"` + ID int64 `gorm:"primary_key;auto_increment;not_null" json:"id"` DeviceID string `gorm:"index:idx_scheduled_update_log_device,unique" json:"deviceId"` Device IOSDevice `gorm:"constraint:OnDelete:CASCADE;" json:"device"` Type string `gorm:"type:enum ('grades');" json:"type"` diff --git a/server/model/iosSchedulingPriority.go b/server/model/iosSchedulingPriority.go index ffbb3300..39bd9ab5 100644 --- a/server/model/iosSchedulingPriority.go +++ b/server/model/iosSchedulingPriority.go @@ -8,12 +8,12 @@ import ( // IOSSchedulingPriority stores some default priorities for the scheduling of // grade updates. type IOSSchedulingPriority struct { - ID int `gorm:"primary_key;auto_increment;not_null" json:"id"` - FromDay int `gorm:"not null" json:"from_day"` - ToDay int `gorm:"not null" json:"to_day"` - FromHour int `gorm:"not null" json:"from_hour"` - ToHour int `gorm:"not null" json:"to_hour"` - Priority int `gorm:"not null" json:"priority"` + ID int64 `gorm:"primary_key;auto_increment;not_null" json:"id"` + FromDay int `gorm:"not null" json:"from_day"` + ToDay int `gorm:"not null" json:"to_day"` + FromHour int `gorm:"not null" json:"from_hour"` + ToHour int `gorm:"not null" json:"to_hour"` + Priority int `gorm:"not null" json:"priority"` } // IsCurrentlyInRange returns true if the current time is in the range of the diff --git a/server/model/ios_grade.go b/server/model/ios_grade.go index 1d38cbb1..a4fdb061 100644 --- a/server/model/ios_grade.go +++ b/server/model/ios_grade.go @@ -55,7 +55,7 @@ func (grade *IOSGrade) CompareToEncrypted(encryptedGrade *IOSEncryptedGrade) boo // IOSEncryptedGrade is a grade that can be encrypted. // Whether it is currently encrypted or not is indicated by the IsEncrypted field. type IOSEncryptedGrade struct { - ID uint `gorm:"primaryKey"` + ID int64 `gorm:"primaryKey"` Device IOSDevice `gorm:"constraint:OnDelete:CASCADE"` DeviceID string `gorm:"index;not null"` LectureTitle string `gorm:"not null"` diff --git a/server/model/news.go b/server/model/news.go index dc3ef1bd..4cabb46c 100755 --- a/server/model/news.go +++ b/server/model/news.go @@ -15,12 +15,12 @@ var ( // News struct is a row record of the news table in the tca database type News struct { - News int32 `gorm:"primary_key;AUTO_INCREMENT;column:news;type:int;"` + News int64 `gorm:"primary_key;AUTO_INCREMENT;column:news;type:int;"` Date time.Time `gorm:"column:date;type:datetime;"` Created time.Time `gorm:"column:created;type:timestamp;default:CURRENT_TIMESTAMP;"` Title string `gorm:"column:title;type:text;size:255;"` Description string `gorm:"column:description;type:text;size:65535;"` - Src int32 `gorm:"column:src;type:int;"` + Src int64 `gorm:"column:src;type:int;"` Link string `gorm:"column:link;type:varchar(190);"` Image null.String `gorm:"column:image;type:text;size:65535;"` FilesID null.Int `gorm:"column:file;type:int;"` diff --git a/server/model/news_alert.go b/server/model/news_alert.go index 0956940a..55a2a65f 100644 --- a/server/model/news_alert.go +++ b/server/model/news_alert.go @@ -17,8 +17,8 @@ var ( // NewsAlert struct is a row record of the news_alert table in the tca database type NewsAlert struct { - NewsAlert int32 `gorm:"primary_key;AUTO_INCREMENT;column:news_alert;type:int;" json:"news_alert"` - FilesID int32 `gorm:"column:file;not null"` + NewsAlert int64 `gorm:"primary_key;AUTO_INCREMENT;column:news_alert;type:int;" json:"news_alert"` + FilesID int64 `gorm:"column:file;not null"` Files Files `gorm:"foreignKey:FilesID;references:file;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"` Name null.String `gorm:"column:name;type:varchar(100);" json:"name"` Link null.String `gorm:"column:link;type:text;size:65535;" json:"link"` diff --git a/server/model/news_source.go b/server/model/news_source.go index 69b91cfe..94d06a2b 100644 --- a/server/model/news_source.go +++ b/server/model/news_source.go @@ -17,10 +17,10 @@ var ( // NewsSource struct is a row record of the newsSource table in the tca database type NewsSource struct { - Source int32 `gorm:"primary_key;AUTO_INCREMENT;column:source;type:int;"` + Source int64 `gorm:"primary_key;AUTO_INCREMENT;column:source;type:int;"` Title string `gorm:"column:title;type:text;size:16777215;"` URL null.String `gorm:"column:url;type:text;size:16777215;"` - FilesID int32 `gorm:"column:icon;not null"` + FilesID int64 `gorm:"column:icon;not null"` Files Files `gorm:"foreignKey:FilesID;references:file;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"` Hook null.String `gorm:"column:hook;type:char;size:12;"` } diff --git a/server/model/notification.go b/server/model/notification.go index c6ada430..8c93943d 100644 --- a/server/model/notification.go +++ b/server/model/notification.go @@ -17,7 +17,7 @@ var ( // Notification struct is a row record of the notification table in the tca database type Notification struct { - Notification int32 `gorm:"primary_key;AUTO_INCREMENT;column:notification;type:int;" json:"notification"` + Notification int64 `gorm:"primary_key;AUTO_INCREMENT;column:notification;type:int;" json:"notification"` Type int32 `gorm:"column:type;type:int;" json:"type"` Location null.Int `gorm:"column:location;type:int;" json:"location"` Title string `gorm:"column:title;type:text;size:65535;" json:"title"` diff --git a/server/model/notification_confirmation.go b/server/model/notification_confirmation.go index 51b7e88d..f5b6a39c 100644 --- a/server/model/notification_confirmation.go +++ b/server/model/notification_confirmation.go @@ -17,8 +17,8 @@ var ( // NotificationConfirmation struct is a row record of the notification_confirmation table in the tca database type NotificationConfirmation struct { - Notification int32 `gorm:"primary_key;column:notification;type:int;" json:"notification"` - Device int32 `gorm:"primary_key;column:device;type:int;" json:"device"` + Notification int64 `gorm:"primary_key;column:notification;type:int;" json:"notification"` + Device int64 `gorm:"primary_key;column:device;type:int;" json:"device"` Sent int32 `gorm:"column:sent;type:tinyint;default:0;" json:"sent"` Created time.Time `gorm:"column:created;type:timestamp;default:CURRENT_TIMESTAMP;" json:"created"` Received null.Time `gorm:"column:received;type:timestamp;" json:"received"` diff --git a/server/model/notification_type.go b/server/model/notification_type.go index 3b2ae0c7..661383d7 100644 --- a/server/model/notification_type.go +++ b/server/model/notification_type.go @@ -17,7 +17,7 @@ var ( // NotificationType struct is a row record of the notification_type table in the tca database type NotificationType struct { - Type int32 `gorm:"primary_key;AUTO_INCREMENT;column:type;type:int;" json:"type"` + Type int64 `gorm:"primary_key;AUTO_INCREMENT;column:type;type:int;" json:"type"` Name string `gorm:"column:name;type:text;size:65535;" json:"name"` Confirmation string `gorm:"column:confirmation;type:char;size:5;default:false;" json:"confirmation"` } diff --git a/server/model/roomfinder_building2area.go b/server/model/roomfinder_building2area.go index b8babe58..4f72cda4 100644 --- a/server/model/roomfinder_building2area.go +++ b/server/model/roomfinder_building2area.go @@ -17,8 +17,8 @@ var ( // RoomfinderBuilding2area struct is a row record of the roomfinder_building2area table in the tca database type RoomfinderBuilding2area struct { - AreaID int32 `gorm:"column:area_id;type:int;" json:"area_id"` BuildingNr string `gorm:"primary_key;column:building_nr;type:varchar(8);" json:"building_nr"` + AreaID int32 `gorm:"column:area_id;type:int;" json:"area_id"` Campus string `gorm:"column:campus;type:char;size:1;" json:"campus"` Name string `gorm:"column:name;type:varchar(32);" json:"name"` } diff --git a/server/model/roomfinder_buildings2maps.go b/server/model/roomfinder_buildings2maps.go index 6559cf03..50b3cecf 100644 --- a/server/model/roomfinder_buildings2maps.go +++ b/server/model/roomfinder_buildings2maps.go @@ -18,7 +18,7 @@ var ( // RoomfinderBuildings2maps struct is a row record of the roomfinder_buildings2maps table in the tca database type RoomfinderBuildings2maps struct { BuildingNr string `gorm:"primary_key;column:building_nr;type:varchar(8);" json:"building_nr"` - MapID int32 `gorm:"primary_key;column:map_id;type:int;" json:"map_id"` + MapID int64 `gorm:"primary_key;column:map_id;type:int;" json:"map_id"` } // TableName sets the insert table name for this struct type diff --git a/server/model/roomfinder_maps.go b/server/model/roomfinder_maps.go index a1f2fae7..e34f6a55 100644 --- a/server/model/roomfinder_maps.go +++ b/server/model/roomfinder_maps.go @@ -17,7 +17,7 @@ var ( // RoomfinderMaps struct is a row record of the roomfinder_maps table in the tca database type RoomfinderMaps struct { - MapID int32 `gorm:"primary_key;column:map_id;type:int;" json:"map_id"` + MapID int64 `gorm:"primary_key;column:map_id;type:int;" json:"map_id"` Description string `gorm:"column:description;type:varchar(64);" json:"description"` Scale int32 `gorm:"column:scale;type:int;" json:"scale"` Width int32 `gorm:"column:width;type:int;" json:"width"` diff --git a/server/model/roomfinder_rooms.go b/server/model/roomfinder_rooms.go index e7fb8c2e..3b81d041 100644 --- a/server/model/roomfinder_rooms.go +++ b/server/model/roomfinder_rooms.go @@ -17,7 +17,7 @@ var ( // RoomfinderRooms struct is a row record of the roomfinder_rooms table in the tca database type RoomfinderRooms struct { - RoomID int32 `gorm:"primary_key;column:room_id;type:int;" json:"room_id"` + RoomID int64 `gorm:"primary_key;column:room_id;type:int;" json:"room_id"` RoomCode null.String `gorm:"column:room_code;type:varchar(32);" json:"room_code"` BuildingNr null.String `gorm:"column:building_nr;type:varchar(8);" json:"building_nr"` ArchID null.String `gorm:"column:arch_id;type:varchar(16);" json:"arch_id"` diff --git a/server/model/roomfinder_rooms2maps.go b/server/model/roomfinder_rooms2maps.go index 1af8d278..a7c7bafc 100644 --- a/server/model/roomfinder_rooms2maps.go +++ b/server/model/roomfinder_rooms2maps.go @@ -17,8 +17,8 @@ var ( // RoomfinderRooms2maps struct is a row record of the roomfinder_rooms2maps table in the tca database type RoomfinderRooms2maps struct { - RoomID int32 `gorm:"primary_key;column:room_id;type:int;" json:"room_id"` - MapID int32 `gorm:"primary_key;column:map_id;type:int;" json:"map_id"` + RoomID int64 `gorm:"primary_key;column:room_id;type:int;" json:"room_id"` + MapID int64 `gorm:"primary_key;column:map_id;type:int;" json:"map_id"` } // TableName sets the insert table name for this struct type diff --git a/server/model/updateNote.go b/server/model/updateNote.go index 15ec9c7d..ad83708f 100755 --- a/server/model/updateNote.go +++ b/server/model/updateNote.go @@ -2,7 +2,7 @@ package model // UpdateNote struct for update notes type UpdateNote struct { - VersionCode int32 `gorm:"primary_key;AUTO_INCREMENT;column:version_code;type:int;"` + VersionCode int64 `gorm:"primary_key;AUTO_INCREMENT;column:version_code;type:int;"` VersionName string `gorm:"column:version_name;type:text;"` Message string `gorm:"column:message;type:text;"` }