From 3b61036b5a18d5dfd071eaf95827463354ec449d Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Thu, 31 Aug 2023 00:59:50 +0200 Subject: [PATCH] renamed cafeteria -> canteen in all publicly accessible interfaces --- client/localServer/client.go | 70 +++++----- server/api/tumdev/campus_backend.pb.gw.go | 132 +++++++++--------- server/api/tumdev/campus_backend.proto | 48 +++---- server/api/tumdev/campus_backend.swagger.json | 128 ++++++++--------- server/api/tumdev/campus_backend_grpc.pb.go | 116 +++++++-------- server/backend/cafeteriaService.go | 28 ++-- 6 files changed, 261 insertions(+), 261 deletions(-) diff --git a/client/localServer/client.go b/client/localServer/client.go index 813c8ae7..0a010de6 100644 --- a/client/localServer/client.go +++ b/client/localServer/client.go @@ -22,7 +22,7 @@ const ( testImage = "./localServer/images/sampleimage.jpeg" ) -// main connects to a seperatly started local server and creates ratings for both, cafeterias and dishes. +// main connects to a seperatly started local server and creates ratings for both, canteens and dishes. // Afterwards, they are queried and displayed on the console func main() { // Set up a connection to the local server. @@ -38,7 +38,7 @@ func main() { canteenHeadCount(c, ctx) - cafeteriaRatingTools(c, ctx) + canteenRatingTools(c, ctx) } @@ -54,28 +54,28 @@ func canteenHeadCount(c pb.CampusClient, ctx context.Context) { } } -func cafeteriaRatingTools(c pb.CampusClient, ctx context.Context) { +func canteenRatingTools(c pb.CampusClient, ctx context.Context) { - currentCafeteria := "MENSA_GARCHING" + currentCanteen := "MENSA_GARCHING" currentDish := "Vegane rote Grütze mit Soja-Vanillesauce" //must be in the dish table - generateDishRating(c, ctx, currentCafeteria, currentDish, 3) - generateCafeteriaRating(c, ctx, currentCafeteria, 2) - queryCafeteria(currentCafeteria, c, ctx, true) - queryDish(currentCafeteria, currentDish, c, ctx, false) - generateCafeteriaRating(c, ctx, currentCafeteria, 2) - generateCafeteriaRating(c, ctx, currentCafeteria, 2) - generateDishRating(c, ctx, currentCafeteria, currentDish, 1) + generateDishRating(c, ctx, currentCanteen, currentDish, 3) + generateCanteenRating(c, ctx, currentCanteen, 2) + queryCanteen(currentCanteen, c, ctx, true) + queryDish(currentCanteen, currentDish, c, ctx, false) + generateCanteenRating(c, ctx, currentCanteen, 2) + generateCanteenRating(c, ctx, currentCanteen, 2) + generateDishRating(c, ctx, currentCanteen, currentDish, 1) - queryCafeteria(currentCafeteria, c, ctx, false) - queryDish(currentCafeteria, currentDish, c, ctx, false) + queryCanteen(currentCanteen, c, ctx, false) + queryDish(currentCanteen, currentDish, c, ctx, false) } -func queryDish(cafeteria string, dish string, c pb.CampusClient, ctx context.Context, imageShouldBeStored bool) { +func queryDish(canteen string, dish string, c pb.CampusClient, ctx context.Context, imageShouldBeStored bool) { res, err := c.GetDishRatings(ctx, &pb.DishRatingRequest{ - Dish: dish, - CafeteriaId: cafeteria, - Limit: 3, + Dish: dish, + CanteenId: canteen, + Limit: 3, }) if err != nil { @@ -129,10 +129,10 @@ func queryDish(cafeteria string, dish string, c pb.CampusClient, ctx context.Con } } -func queryCafeteria(s string, c pb.CampusClient, ctx context.Context, imageShouldBeStored bool) { - res, err := c.GetCafeteriaRatings(ctx, &pb.CafeteriaRatingRequest{ - CafeteriaId: s, - Limit: 3, +func queryCanteen(s string, c pb.CampusClient, ctx context.Context, imageShouldBeStored bool) { + res, err := c.GetCanteenRatings(ctx, &pb.CanteenRatingRequest{ + CanteenId: s, + Limit: 3, // From: timestamppb.New(time.Date(2022, 7, 8, 16, 0, 0, 0, time.Local)), // To: timestamppb.New(time.Date(2022, 7, 8, 17, 0, 0, 0, time.Local)), }) @@ -178,7 +178,7 @@ func queryCafeteria(s string, c pb.CampusClient, ctx context.Context, imageShoul } } -func generateCafeteriaRating(c pb.CampusClient, ctx context.Context, cafeteria string, rating int32) { +func generateCanteenRating(c pb.CampusClient, ctx context.Context, canteen string, rating int32) { y := make([]*pb.RatingTag, 2) y[0] = &pb.RatingTag{ Points: float64(1 + rating), @@ -189,12 +189,12 @@ func generateCafeteriaRating(c pb.CampusClient, ctx context.Context, cafeteria s TagId: 2, } - _, err := c.NewCafeteriaRating(ctx, &pb.NewCafeteriaRatingRequest{ - Points: rating, - CafeteriaId: cafeteria, - Comment: "Alles super, 2 Sterne", - RatingTags: y, - Image: getImageToBytes(testImage), + _, err := c.NewCanteenRating(ctx, &pb.NewCanteenRatingRequest{ + Points: rating, + CanteenId: canteen, + Comment: "Alles super, 2 Sterne", + RatingTags: y, + Image: getImageToBytes(testImage), }) if err != nil { @@ -204,7 +204,7 @@ func generateCafeteriaRating(c pb.CampusClient, ctx context.Context, cafeteria s } } -func generateDishRating(c pb.CampusClient, ctx context.Context, cafeteria string, dish string, rating int32) { +func generateDishRating(c pb.CampusClient, ctx context.Context, canteen string, dish string, rating int32) { y := make([]*pb.RatingTag, 3) y[0] = &pb.RatingTag{ Points: float64(1 + rating), @@ -220,12 +220,12 @@ func generateDishRating(c pb.CampusClient, ctx context.Context, cafeteria string } _, err := c.NewDishRating(ctx, &pb.NewDishRatingRequest{ - Points: rating, - CafeteriaId: cafeteria, - Dish: dish, - Comment: "Alles Hähnchen", - RatingTags: y, - Image: getImageToBytes(testImage), + Points: rating, + CanteenId: canteen, + Dish: dish, + Comment: "Alles Hähnchen", + RatingTags: y, + Image: getImageToBytes(testImage), }) if err != nil { diff --git a/server/api/tumdev/campus_backend.pb.gw.go b/server/api/tumdev/campus_backend.pb.gw.go index a143fd43..30a907c7 100644 --- a/server/api/tumdev/campus_backend.pb.gw.go +++ b/server/api/tumdev/campus_backend.pb.gw.go @@ -256,8 +256,8 @@ func local_request_Campus_GetRoomSchedule_0(ctx context.Context, marshaler runti } -func request_Campus_GetCafeteriaRatings_0(ctx context.Context, marshaler runtime.Marshaler, client CampusClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq CafeteriaRatingRequest +func request_Campus_GetCanteenRatings_0(ctx context.Context, marshaler runtime.Marshaler, client CampusClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CanteenRatingRequest var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) @@ -268,13 +268,13 @@ func request_Campus_GetCafeteriaRatings_0(ctx context.Context, marshaler runtime return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.GetCafeteriaRatings(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.GetCanteenRatings(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Campus_GetCafeteriaRatings_0(ctx context.Context, marshaler runtime.Marshaler, server CampusServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq CafeteriaRatingRequest +func local_request_Campus_GetCanteenRatings_0(ctx context.Context, marshaler runtime.Marshaler, server CampusServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CanteenRatingRequest var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) @@ -285,7 +285,7 @@ func local_request_Campus_GetCafeteriaRatings_0(ctx context.Context, marshaler r return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.GetCafeteriaRatings(ctx, &protoReq) + msg, err := server.GetCanteenRatings(ctx, &protoReq) return msg, metadata, err } @@ -324,8 +324,8 @@ func local_request_Campus_GetDishRatings_0(ctx context.Context, marshaler runtim } -func request_Campus_NewCafeteriaRating_0(ctx context.Context, marshaler runtime.Marshaler, client CampusClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq NewCafeteriaRatingRequest +func request_Campus_NewCanteenRating_0(ctx context.Context, marshaler runtime.Marshaler, client CampusClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq NewCanteenRatingRequest var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) @@ -336,13 +336,13 @@ func request_Campus_NewCafeteriaRating_0(ctx context.Context, marshaler runtime. return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.NewCafeteriaRating(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.NewCanteenRating(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Campus_NewCafeteriaRating_0(ctx context.Context, marshaler runtime.Marshaler, server CampusServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq NewCafeteriaRatingRequest +func local_request_Campus_NewCanteenRating_0(ctx context.Context, marshaler runtime.Marshaler, server CampusServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq NewCanteenRatingRequest var metadata runtime.ServerMetadata newReader, berr := utilities.IOReaderFactory(req.Body) @@ -353,7 +353,7 @@ func local_request_Campus_NewCafeteriaRating_0(ctx context.Context, marshaler ru return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.NewCafeteriaRating(ctx, &protoReq) + msg, err := server.NewCanteenRating(ctx, &protoReq) return msg, metadata, err } @@ -428,38 +428,38 @@ func local_request_Campus_GetNameTags_0(ctx context.Context, marshaler runtime.M } -func request_Campus_GetAvailableCafeteriaTags_0(ctx context.Context, marshaler runtime.Marshaler, client CampusClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_Campus_GetAvailableCanteenTags_0(ctx context.Context, marshaler runtime.Marshaler, client CampusClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq emptypb.Empty var metadata runtime.ServerMetadata - msg, err := client.GetAvailableCafeteriaTags(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.GetAvailableCanteenTags(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Campus_GetAvailableCafeteriaTags_0(ctx context.Context, marshaler runtime.Marshaler, server CampusServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func local_request_Campus_GetAvailableCanteenTags_0(ctx context.Context, marshaler runtime.Marshaler, server CampusServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq emptypb.Empty var metadata runtime.ServerMetadata - msg, err := server.GetAvailableCafeteriaTags(ctx, &protoReq) + msg, err := server.GetAvailableCanteenTags(ctx, &protoReq) return msg, metadata, err } -func request_Campus_GetCafeterias_0(ctx context.Context, marshaler runtime.Marshaler, client CampusClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_Campus_GetCanteens_0(ctx context.Context, marshaler runtime.Marshaler, client CampusClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq emptypb.Empty var metadata runtime.ServerMetadata - msg, err := client.GetCafeterias(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.GetCanteens(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Campus_GetCafeterias_0(ctx context.Context, marshaler runtime.Marshaler, server CampusServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func local_request_Campus_GetCanteens_0(ctx context.Context, marshaler runtime.Marshaler, server CampusServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq emptypb.Empty var metadata runtime.ServerMetadata - msg, err := server.GetCafeterias(ctx, &protoReq) + msg, err := server.GetCanteens(ctx, &protoReq) return msg, metadata, err } @@ -1487,7 +1487,7 @@ func RegisterCampusHandlerServer(ctx context.Context, mux *runtime.ServeMux, ser }) - mux.Handle("POST", pattern_Campus_GetCafeteriaRatings_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_Campus_GetCanteenRatings_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1495,12 +1495,12 @@ func RegisterCampusHandlerServer(ctx context.Context, mux *runtime.ServeMux, ser inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/api.Campus/GetCafeteriaRatings", runtime.WithHTTPPathPattern("/cafeteria/rating/get")) + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/api.Campus/GetCanteenRatings", runtime.WithHTTPPathPattern("/canteen/rating/get")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Campus_GetCafeteriaRatings_0(annotatedContext, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Campus_GetCanteenRatings_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { @@ -1508,7 +1508,7 @@ func RegisterCampusHandlerServer(ctx context.Context, mux *runtime.ServeMux, ser return } - forward_Campus_GetCafeteriaRatings_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Campus_GetCanteenRatings_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1537,7 +1537,7 @@ func RegisterCampusHandlerServer(ctx context.Context, mux *runtime.ServeMux, ser }) - mux.Handle("POST", pattern_Campus_NewCafeteriaRating_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_Campus_NewCanteenRating_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1545,12 +1545,12 @@ func RegisterCampusHandlerServer(ctx context.Context, mux *runtime.ServeMux, ser inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/api.Campus/NewCafeteriaRating", runtime.WithHTTPPathPattern("/cafeteria/rating/new")) + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/api.Campus/NewCanteenRating", runtime.WithHTTPPathPattern("/canteen/rating/new")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Campus_NewCafeteriaRating_0(annotatedContext, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Campus_NewCanteenRating_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { @@ -1558,7 +1558,7 @@ func RegisterCampusHandlerServer(ctx context.Context, mux *runtime.ServeMux, ser return } - forward_Campus_NewCafeteriaRating_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Campus_NewCanteenRating_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1637,7 +1637,7 @@ func RegisterCampusHandlerServer(ctx context.Context, mux *runtime.ServeMux, ser }) - mux.Handle("GET", pattern_Campus_GetAvailableCafeteriaTags_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Campus_GetAvailableCanteenTags_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1645,12 +1645,12 @@ func RegisterCampusHandlerServer(ctx context.Context, mux *runtime.ServeMux, ser inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/api.Campus/GetAvailableCafeteriaTags", runtime.WithHTTPPathPattern("/cafeteria/rating/allRatingTags")) + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/api.Campus/GetAvailableCanteenTags", runtime.WithHTTPPathPattern("/canteen/rating/allRatingTags")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Campus_GetAvailableCafeteriaTags_0(annotatedContext, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Campus_GetAvailableCanteenTags_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { @@ -1658,11 +1658,11 @@ func RegisterCampusHandlerServer(ctx context.Context, mux *runtime.ServeMux, ser return } - forward_Campus_GetAvailableCafeteriaTags_0(annotatedContext, mux, outboundMarshaler, w, req, response_Campus_GetAvailableCafeteriaTags_0{resp}, mux.GetForwardResponseOptions()...) + forward_Campus_GetAvailableCanteenTags_0(annotatedContext, mux, outboundMarshaler, w, req, response_Campus_GetAvailableCanteenTags_0{resp}, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Campus_GetCafeterias_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Campus_GetCanteens_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -1670,12 +1670,12 @@ func RegisterCampusHandlerServer(ctx context.Context, mux *runtime.ServeMux, ser inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/api.Campus/GetCafeterias", runtime.WithHTTPPathPattern("/cafeteria/allCafeterias")) + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/api.Campus/GetCanteens", runtime.WithHTTPPathPattern("/canteen/allCanteens")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Campus_GetCafeterias_0(annotatedContext, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Campus_GetCanteens_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { @@ -1683,7 +1683,7 @@ func RegisterCampusHandlerServer(ctx context.Context, mux *runtime.ServeMux, ser return } - forward_Campus_GetCafeterias_0(annotatedContext, mux, outboundMarshaler, w, req, response_Campus_GetCafeterias_0{resp}, mux.GetForwardResponseOptions()...) + forward_Campus_GetCanteens_0(annotatedContext, mux, outboundMarshaler, w, req, response_Campus_GetCanteens_0{resp}, mux.GetForwardResponseOptions()...) }) @@ -2407,25 +2407,25 @@ func RegisterCampusHandlerClient(ctx context.Context, mux *runtime.ServeMux, cli }) - mux.Handle("POST", pattern_Campus_GetCafeteriaRatings_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_Campus_GetCanteenRatings_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/api.Campus/GetCafeteriaRatings", runtime.WithHTTPPathPattern("/cafeteria/rating/get")) + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/api.Campus/GetCanteenRatings", runtime.WithHTTPPathPattern("/canteen/rating/get")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Campus_GetCafeteriaRatings_0(annotatedContext, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Campus_GetCanteenRatings_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_Campus_GetCafeteriaRatings_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Campus_GetCanteenRatings_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -2451,25 +2451,25 @@ func RegisterCampusHandlerClient(ctx context.Context, mux *runtime.ServeMux, cli }) - mux.Handle("POST", pattern_Campus_NewCafeteriaRating_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_Campus_NewCanteenRating_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/api.Campus/NewCafeteriaRating", runtime.WithHTTPPathPattern("/cafeteria/rating/new")) + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/api.Campus/NewCanteenRating", runtime.WithHTTPPathPattern("/canteen/rating/new")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Campus_NewCafeteriaRating_0(annotatedContext, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Campus_NewCanteenRating_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_Campus_NewCafeteriaRating_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Campus_NewCanteenRating_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -2539,47 +2539,47 @@ func RegisterCampusHandlerClient(ctx context.Context, mux *runtime.ServeMux, cli }) - mux.Handle("GET", pattern_Campus_GetAvailableCafeteriaTags_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Campus_GetAvailableCanteenTags_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/api.Campus/GetAvailableCafeteriaTags", runtime.WithHTTPPathPattern("/cafeteria/rating/allRatingTags")) + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/api.Campus/GetAvailableCanteenTags", runtime.WithHTTPPathPattern("/canteen/rating/allRatingTags")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Campus_GetAvailableCafeteriaTags_0(annotatedContext, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Campus_GetAvailableCanteenTags_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_Campus_GetAvailableCafeteriaTags_0(annotatedContext, mux, outboundMarshaler, w, req, response_Campus_GetAvailableCafeteriaTags_0{resp}, mux.GetForwardResponseOptions()...) + forward_Campus_GetAvailableCanteenTags_0(annotatedContext, mux, outboundMarshaler, w, req, response_Campus_GetAvailableCanteenTags_0{resp}, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Campus_GetCafeterias_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Campus_GetCanteens_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/api.Campus/GetCafeterias", runtime.WithHTTPPathPattern("/cafeteria/allCafeterias")) + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/api.Campus/GetCanteens", runtime.WithHTTPPathPattern("/canteen/allCanteens")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Campus_GetCafeterias_0(annotatedContext, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Campus_GetCanteens_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_Campus_GetCafeterias_0(annotatedContext, mux, outboundMarshaler, w, req, response_Campus_GetCafeterias_0{resp}, mux.GetForwardResponseOptions()...) + forward_Campus_GetCanteens_0(annotatedContext, mux, outboundMarshaler, w, req, response_Campus_GetCanteens_0{resp}, mux.GetForwardResponseOptions()...) }) @@ -3111,22 +3111,22 @@ func (m response_Campus_GetNameTags_0) XXX_ResponseBody() interface{} { return response.RatingTags } -type response_Campus_GetAvailableCafeteriaTags_0 struct { +type response_Campus_GetAvailableCanteenTags_0 struct { proto.Message } -func (m response_Campus_GetAvailableCafeteriaTags_0) XXX_ResponseBody() interface{} { +func (m response_Campus_GetAvailableCanteenTags_0) XXX_ResponseBody() interface{} { response := m.Message.(*GetTagsReply) return response.RatingTags } -type response_Campus_GetCafeterias_0 struct { +type response_Campus_GetCanteens_0 struct { proto.Message } -func (m response_Campus_GetCafeterias_0) XXX_ResponseBody() interface{} { - response := m.Message.(*GetCafeteriaReply) - return response.Cafeteria +func (m response_Campus_GetCanteens_0) XXX_ResponseBody() interface{} { + response := m.Message.(*GetCanteenReply) + return response.Canteen } type response_Campus_GetDishes_0 struct { @@ -3153,11 +3153,11 @@ var ( pattern_Campus_GetRoomSchedule_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"roomfinder", "room", "scheduleById"}, "")) - pattern_Campus_GetCafeteriaRatings_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"cafeteria", "rating", "get"}, "")) + pattern_Campus_GetCanteenRatings_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"canteen", "rating", "get"}, "")) pattern_Campus_GetDishRatings_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"dish", "rating", "get"}, "")) - pattern_Campus_NewCafeteriaRating_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"cafeteria", "rating", "new"}, "")) + pattern_Campus_NewCanteenRating_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"canteen", "rating", "new"}, "")) pattern_Campus_NewDishRating_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"dish", "rating", "new"}, "")) @@ -3165,9 +3165,9 @@ var ( pattern_Campus_GetNameTags_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"dish", "rating", "allDishTags"}, "")) - pattern_Campus_GetAvailableCafeteriaTags_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"cafeteria", "rating", "allRatingTags"}, "")) + pattern_Campus_GetAvailableCanteenTags_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"canteen", "rating", "allRatingTags"}, "")) - pattern_Campus_GetCafeterias_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"cafeteria", "allCafeterias"}, "")) + pattern_Campus_GetCanteens_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"canteen", "allCanteens"}, "")) pattern_Campus_GetDishes_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"dish", "allDishes"}, "")) @@ -3227,11 +3227,11 @@ var ( forward_Campus_GetRoomSchedule_0 = runtime.ForwardResponseMessage - forward_Campus_GetCafeteriaRatings_0 = runtime.ForwardResponseMessage + forward_Campus_GetCanteenRatings_0 = runtime.ForwardResponseMessage forward_Campus_GetDishRatings_0 = runtime.ForwardResponseMessage - forward_Campus_NewCafeteriaRating_0 = runtime.ForwardResponseMessage + forward_Campus_NewCanteenRating_0 = runtime.ForwardResponseMessage forward_Campus_NewDishRating_0 = runtime.ForwardResponseMessage @@ -3239,9 +3239,9 @@ var ( forward_Campus_GetNameTags_0 = runtime.ForwardResponseMessage - forward_Campus_GetAvailableCafeteriaTags_0 = runtime.ForwardResponseMessage + forward_Campus_GetAvailableCanteenTags_0 = runtime.ForwardResponseMessage - forward_Campus_GetCafeterias_0 = runtime.ForwardResponseMessage + forward_Campus_GetCanteens_0 = runtime.ForwardResponseMessage forward_Campus_GetDishes_0 = runtime.ForwardResponseMessage diff --git a/server/api/tumdev/campus_backend.proto b/server/api/tumdev/campus_backend.proto index acf930d4..04d5c0da 100644 --- a/server/api/tumdev/campus_backend.proto +++ b/server/api/tumdev/campus_backend.proto @@ -66,10 +66,10 @@ service Campus { } - // This endpoint retrieves Cafeteria Ratings from the Backend. - rpc GetCafeteriaRatings (CafeteriaRatingRequest) returns (CafeteriaRatingReply) { + // This endpoint retrieves Canteen Ratings from the Backend. + rpc GetCanteenRatings (CanteenRatingRequest) returns (CanteenRatingReply) { option (google.api.http) = { - post: "/cafeteria/rating/get", + post: "/canteen/rating/get", body: "*", }; } @@ -84,9 +84,9 @@ service Campus { - rpc NewCafeteriaRating (NewCafeteriaRatingRequest) returns (google.protobuf.Empty) { + rpc NewCanteenRating (NewCanteenRatingRequest) returns (google.protobuf.Empty) { option (google.api.http) = { - post: "/cafeteria/rating/new", + post: "/canteen/rating/new", body: "*", }; } @@ -112,17 +112,17 @@ service Campus { }; } - rpc GetAvailableCafeteriaTags (google.protobuf.Empty) returns (GetTagsReply) { + rpc GetAvailableCanteenTags (google.protobuf.Empty) returns (GetTagsReply) { option (google.api.http) = { - get: "/cafeteria/rating/allRatingTags", + get: "/canteen/rating/allRatingTags", response_body: "ratingTags" }; } - rpc GetCafeterias (google.protobuf.Empty) returns (GetCafeteriaReply) { + rpc GetCanteens (google.protobuf.Empty) returns (GetCanteenReply) { option (google.api.http) = { - get: "/cafeteria/allCafeterias", - response_body: "cafeteria" + get: "/canteen/allCanteens", + response_body: "canteen" }; } @@ -394,9 +394,9 @@ message GetTopNewsReply { google.protobuf.Timestamp to = 5; } -message CafeteriaRatingRequest { - // cafeteriaId Mandatory Name of the cafeteria (EAT-API naming scheme "MENSA_GARCHING") - string cafeteriaId = 1; +message CanteenRatingRequest { + // canteenId Mandatory Name of the canteen (EAT-API naming scheme "MENSA_GARCHING") + string canteenId = 1; // Optional Parameter to define an interval for the ratings (Lower bound) google.protobuf.Timestamp from = 2; // Optional Parameter to define an interval for the ratings (Upper bound) @@ -407,8 +407,8 @@ message CafeteriaRatingRequest { } message DishRatingRequest { - // Mandatory Name of the cafeteria (EAT-API naming scheme "MENSA_GARCHING") - string cafeteriaId = 1; + // Mandatory Name of the canteen (EAT-API naming scheme "MENSA_GARCHING") + string canteenId = 1; // Mandatory Name of the dish (EAT-API naming scheme) Must be available int the given mensa string dish = 2; // Optional Parameter to define an interval for the ratings (Lower bound) @@ -419,7 +419,7 @@ message DishRatingRequest { int32 limit = 5; } -message CafeteriaRatingReply { +message CanteenRatingReply { repeated SingleRatingReply rating = 1; double avg = 2; double std = 3; @@ -449,12 +449,12 @@ message SingleRatingReply{ google.protobuf.Timestamp visited = 5; } -message NewCafeteriaRatingRequest{ +message NewCanteenRatingRequest{ // number in the range 1-5 int32 points = 1; - string cafeteriaId = 2; + string canteenId = 2; bytes image = 3; - // Optional list of tag ratings add as many tags with a rating (1-5) of the list of cafeteriaRatingTags + // Optional list of tag ratings add as many tags with a rating (1-5) of the list of canteenRatingTags repeated RatingTag ratingTags = 4; // Optional comment (max 256 chars) string comment = 6; @@ -464,7 +464,7 @@ message NewDishRatingRequest{ // number in the range 1-5 int32 points = 1; // Mandatory Name of the dish (EAT-API naming scheme "MENSA_GARCHING") Must be available int the given mensa - string cafeteriaId = 2; + string canteenId = 2; // Mandatory Name of the dish (EAT-API naming scheme) Must be available int the given mensa string dish = 3; // Optional JPEG image in Base64 @@ -503,11 +503,11 @@ message RatingTagResult { int32 max = 5; } -message GetCafeteriaReply{ - repeated Cafeteria cafeteria = 1; +message GetCanteenReply{ + repeated Canteen canteen = 1; } -message Cafeteria{ +message Canteen{ string id = 1; string address = 2; double longitude = 3; @@ -516,7 +516,7 @@ message Cafeteria{ message GetDishesRequest{ - string cafeteriaId = 1; + string canteenId = 1; // >=2022 until the current year int32 year = 2; // range 1 - 53 diff --git a/server/api/tumdev/campus_backend.swagger.json b/server/api/tumdev/campus_backend.swagger.json index 81962c9a..7506ef35 100644 --- a/server/api/tumdev/campus_backend.swagger.json +++ b/server/api/tumdev/campus_backend.swagger.json @@ -157,9 +157,9 @@ ] } }, - "/cafeteria/allCafeterias": { + "/canteen/allCanteens": { "get": { - "operationId": "Campus_GetCafeterias", + "operationId": "Campus_GetCanteens", "responses": { "200": { "description": "", @@ -167,7 +167,7 @@ "type": "array", "items": { "type": "object", - "$ref": "#/definitions/apiCafeteria" + "$ref": "#/definitions/apiCanteen" } } }, @@ -183,18 +183,14 @@ ] } }, - "/cafeteria/rating/allRatingTags": { + "/canteen/headCount/{canteenId}": { "get": { - "operationId": "Campus_GetAvailableCafeteriaTags", + "operationId": "Campus_GetCanteenHeadCount", "responses": { "200": { - "description": "", + "description": "A successful response.", "schema": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/apiTagsOverview" - } + "$ref": "#/definitions/apiGetCanteenHeadCountReply" } }, "default": { @@ -204,20 +200,32 @@ } } }, + "parameters": [ + { + "name": "canteenId", + "description": "The requested canteen ID", + "in": "path", + "required": true, + "type": "string" + } + ], "tags": [ "Campus" ] } }, - "/cafeteria/rating/get": { - "post": { - "summary": "This endpoint retrieves Cafeteria Ratings from the Backend.", - "operationId": "Campus_GetCafeteriaRatings", + "/canteen/rating/allRatingTags": { + "get": { + "operationId": "Campus_GetAvailableCanteenTags", "responses": { "200": { - "description": "A successful response.", + "description": "", "schema": { - "$ref": "#/definitions/apiCafeteriaRatingReply" + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/apiTagsOverview" + } } }, "default": { @@ -227,30 +235,20 @@ } } }, - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/apiCafeteriaRatingRequest" - } - } - ], "tags": [ "Campus" ] } }, - "/cafeteria/rating/new": { + "/canteen/rating/get": { "post": { - "operationId": "Campus_NewCafeteriaRating", + "summary": "This endpoint retrieves Canteen Ratings from the Backend.", + "operationId": "Campus_GetCanteenRatings", "responses": { "200": { "description": "A successful response.", "schema": { - "type": "object", - "properties": {} + "$ref": "#/definitions/apiCanteenRatingReply" } }, "default": { @@ -266,7 +264,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/apiNewCafeteriaRatingRequest" + "$ref": "#/definitions/apiCanteenRatingRequest" } } ], @@ -275,14 +273,15 @@ ] } }, - "/canteen/headCount/{canteenId}": { - "get": { - "operationId": "Campus_GetCanteenHeadCount", + "/canteen/rating/new": { + "post": { + "operationId": "Campus_NewCanteenRating", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/apiGetCanteenHeadCountReply" + "type": "object", + "properties": {} } }, "default": { @@ -294,11 +293,12 @@ }, "parameters": [ { - "name": "canteenId", - "description": "The requested canteen ID", - "in": "path", + "name": "body", + "in": "body", "required": true, - "type": "string" + "schema": { + "$ref": "#/definitions/apiNewCanteenRatingRequest" + } } ], "tags": [ @@ -434,7 +434,7 @@ }, "parameters": [ { - "name": "cafeteriaId", + "name": "canteenId", "in": "query", "required": false, "type": "string" @@ -1231,7 +1231,7 @@ } } }, - "apiCafeteria": { + "apiCanteen": { "type": "object", "properties": { "id": { @@ -1250,7 +1250,7 @@ } } }, - "apiCafeteriaRatingReply": { + "apiCanteenRatingReply": { "type": "object", "properties": { "rating": { @@ -1285,12 +1285,12 @@ } } }, - "apiCafeteriaRatingRequest": { + "apiCanteenRatingRequest": { "type": "object", "properties": { - "cafeteriaId": { + "canteenId": { "type": "string", - "title": "cafeteriaId Mandatory Name of the cafeteria (EAT-API naming scheme \"MENSA_GARCHING\")" + "title": "canteenId Mandatory Name of the canteen (EAT-API naming scheme \"MENSA_GARCHING\")" }, "from": { "type": "string", @@ -1363,9 +1363,9 @@ "apiDishRatingRequest": { "type": "object", "properties": { - "cafeteriaId": { + "canteenId": { "type": "string", - "title": "Mandatory Name of the cafeteria (EAT-API naming scheme \"MENSA_GARCHING\")" + "title": "Mandatory Name of the canteen (EAT-API naming scheme \"MENSA_GARCHING\")" }, "dish": { "type": "string", @@ -1412,18 +1412,6 @@ } } }, - "apiGetCafeteriaReply": { - "type": "object", - "properties": { - "cafeteria": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/apiCafeteria" - } - } - } - }, "apiGetCanteenHeadCountReply": { "type": "object", "properties": { @@ -1449,6 +1437,18 @@ } } }, + "apiGetCanteenReply": { + "type": "object", + "properties": { + "canteen": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/apiCanteen" + } + } + } + }, "apiGetDishesReply": { "type": "object", "properties": { @@ -1847,7 +1847,7 @@ } } }, - "apiNewCafeteriaRatingRequest": { + "apiNewCanteenRatingRequest": { "type": "object", "properties": { "points": { @@ -1855,7 +1855,7 @@ "format": "int32", "title": "number in the range 1-5" }, - "cafeteriaId": { + "canteenId": { "type": "string" }, "image": { @@ -1868,7 +1868,7 @@ "type": "object", "$ref": "#/definitions/apiRatingTag" }, - "title": "Optional list of tag ratings add as many tags with a rating (1-5) of the list of cafeteriaRatingTags" + "title": "Optional list of tag ratings add as many tags with a rating (1-5) of the list of canteenRatingTags" }, "comment": { "type": "string", @@ -1884,7 +1884,7 @@ "format": "int32", "title": "number in the range 1-5" }, - "cafeteriaId": { + "canteenId": { "type": "string", "title": "Mandatory Name of the dish (EAT-API naming scheme \"MENSA_GARCHING\") Must be available int the given mensa" }, diff --git a/server/api/tumdev/campus_backend_grpc.pb.go b/server/api/tumdev/campus_backend_grpc.pb.go index 5fe93432..405473c1 100644 --- a/server/api/tumdev/campus_backend_grpc.pb.go +++ b/server/api/tumdev/campus_backend_grpc.pb.go @@ -28,14 +28,14 @@ const ( Campus_GetRoomMaps_FullMethodName = "/api.Campus/GetRoomMaps" Campus_GetRoomCoordinates_FullMethodName = "/api.Campus/GetRoomCoordinates" Campus_GetRoomSchedule_FullMethodName = "/api.Campus/GetRoomSchedule" - Campus_GetCafeteriaRatings_FullMethodName = "/api.Campus/GetCafeteriaRatings" + Campus_GetCanteenRatings_FullMethodName = "/api.Campus/GetCanteenRatings" Campus_GetDishRatings_FullMethodName = "/api.Campus/GetDishRatings" - Campus_NewCafeteriaRating_FullMethodName = "/api.Campus/NewCafeteriaRating" + Campus_NewCanteenRating_FullMethodName = "/api.Campus/NewCanteenRating" Campus_NewDishRating_FullMethodName = "/api.Campus/NewDishRating" Campus_GetAvailableDishTags_FullMethodName = "/api.Campus/GetAvailableDishTags" Campus_GetNameTags_FullMethodName = "/api.Campus/GetNameTags" - Campus_GetAvailableCafeteriaTags_FullMethodName = "/api.Campus/GetAvailableCafeteriaTags" - Campus_GetCafeterias_FullMethodName = "/api.Campus/GetCafeterias" + Campus_GetAvailableCanteenTags_FullMethodName = "/api.Campus/GetAvailableCanteenTags" + Campus_GetCanteens_FullMethodName = "/api.Campus/GetCanteens" Campus_GetDishes_FullMethodName = "/api.Campus/GetDishes" Campus_GetResponsiblePerson_FullMethodName = "/api.Campus/GetResponsiblePerson" Campus_GetBuilding2Gps_FullMethodName = "/api.Campus/GetBuilding2Gps" @@ -71,15 +71,15 @@ type CampusClient interface { GetRoomMaps(ctx context.Context, in *GetRoomMapsRequest, opts ...grpc.CallOption) (*GetRoomMapsReply, error) GetRoomCoordinates(ctx context.Context, in *GetRoomCoordinatesRequest, opts ...grpc.CallOption) (*GetRoomCoordinatesReply, error) GetRoomSchedule(ctx context.Context, in *GetRoomScheduleRequest, opts ...grpc.CallOption) (*GetRoomScheduleReply, error) - // This endpoint retrieves Cafeteria Ratings from the Backend. - GetCafeteriaRatings(ctx context.Context, in *CafeteriaRatingRequest, opts ...grpc.CallOption) (*CafeteriaRatingReply, error) + // This endpoint retrieves Canteen Ratings from the Backend. + GetCanteenRatings(ctx context.Context, in *CanteenRatingRequest, opts ...grpc.CallOption) (*CanteenRatingReply, error) GetDishRatings(ctx context.Context, in *DishRatingRequest, opts ...grpc.CallOption) (*DishRatingReply, error) - NewCafeteriaRating(ctx context.Context, in *NewCafeteriaRatingRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) + NewCanteenRating(ctx context.Context, in *NewCanteenRatingRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) NewDishRating(ctx context.Context, in *NewDishRatingRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) GetAvailableDishTags(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*GetTagsReply, error) GetNameTags(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*GetTagsReply, error) - GetAvailableCafeteriaTags(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*GetTagsReply, error) - GetCafeterias(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*GetCafeteriaReply, error) + GetAvailableCanteenTags(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*GetTagsReply, error) + GetCanteens(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*GetCanteenReply, error) GetDishes(ctx context.Context, in *GetDishesRequest, opts ...grpc.CallOption) (*GetDishesReply, error) GetResponsiblePerson(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*GetResponsiblePersonReply, error) GetBuilding2Gps(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*GetBuilding2GpsReply, error) @@ -177,9 +177,9 @@ func (c *campusClient) GetRoomSchedule(ctx context.Context, in *GetRoomScheduleR return out, nil } -func (c *campusClient) GetCafeteriaRatings(ctx context.Context, in *CafeteriaRatingRequest, opts ...grpc.CallOption) (*CafeteriaRatingReply, error) { - out := new(CafeteriaRatingReply) - err := c.cc.Invoke(ctx, Campus_GetCafeteriaRatings_FullMethodName, in, out, opts...) +func (c *campusClient) GetCanteenRatings(ctx context.Context, in *CanteenRatingRequest, opts ...grpc.CallOption) (*CanteenRatingReply, error) { + out := new(CanteenRatingReply) + err := c.cc.Invoke(ctx, Campus_GetCanteenRatings_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -195,9 +195,9 @@ func (c *campusClient) GetDishRatings(ctx context.Context, in *DishRatingRequest return out, nil } -func (c *campusClient) NewCafeteriaRating(ctx context.Context, in *NewCafeteriaRatingRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { +func (c *campusClient) NewCanteenRating(ctx context.Context, in *NewCanteenRatingRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, Campus_NewCafeteriaRating_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, Campus_NewCanteenRating_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -231,18 +231,18 @@ func (c *campusClient) GetNameTags(ctx context.Context, in *emptypb.Empty, opts return out, nil } -func (c *campusClient) GetAvailableCafeteriaTags(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*GetTagsReply, error) { +func (c *campusClient) GetAvailableCanteenTags(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*GetTagsReply, error) { out := new(GetTagsReply) - err := c.cc.Invoke(ctx, Campus_GetAvailableCafeteriaTags_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, Campus_GetAvailableCanteenTags_FullMethodName, in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *campusClient) GetCafeterias(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*GetCafeteriaReply, error) { - out := new(GetCafeteriaReply) - err := c.cc.Invoke(ctx, Campus_GetCafeterias_FullMethodName, in, out, opts...) +func (c *campusClient) GetCanteens(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*GetCanteenReply, error) { + out := new(GetCanteenReply) + err := c.cc.Invoke(ctx, Campus_GetCanteens_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -450,15 +450,15 @@ type CampusServer interface { GetRoomMaps(context.Context, *GetRoomMapsRequest) (*GetRoomMapsReply, error) GetRoomCoordinates(context.Context, *GetRoomCoordinatesRequest) (*GetRoomCoordinatesReply, error) GetRoomSchedule(context.Context, *GetRoomScheduleRequest) (*GetRoomScheduleReply, error) - // This endpoint retrieves Cafeteria Ratings from the Backend. - GetCafeteriaRatings(context.Context, *CafeteriaRatingRequest) (*CafeteriaRatingReply, error) + // This endpoint retrieves Canteen Ratings from the Backend. + GetCanteenRatings(context.Context, *CanteenRatingRequest) (*CanteenRatingReply, error) GetDishRatings(context.Context, *DishRatingRequest) (*DishRatingReply, error) - NewCafeteriaRating(context.Context, *NewCafeteriaRatingRequest) (*emptypb.Empty, error) + NewCanteenRating(context.Context, *NewCanteenRatingRequest) (*emptypb.Empty, error) NewDishRating(context.Context, *NewDishRatingRequest) (*emptypb.Empty, error) GetAvailableDishTags(context.Context, *emptypb.Empty) (*GetTagsReply, error) GetNameTags(context.Context, *emptypb.Empty) (*GetTagsReply, error) - GetAvailableCafeteriaTags(context.Context, *emptypb.Empty) (*GetTagsReply, error) - GetCafeterias(context.Context, *emptypb.Empty) (*GetCafeteriaReply, error) + GetAvailableCanteenTags(context.Context, *emptypb.Empty) (*GetTagsReply, error) + GetCanteens(context.Context, *emptypb.Empty) (*GetCanteenReply, error) GetDishes(context.Context, *GetDishesRequest) (*GetDishesReply, error) GetResponsiblePerson(context.Context, *emptypb.Empty) (*GetResponsiblePersonReply, error) GetBuilding2Gps(context.Context, *emptypb.Empty) (*GetBuilding2GpsReply, error) @@ -511,14 +511,14 @@ func (UnimplementedCampusServer) GetRoomCoordinates(context.Context, *GetRoomCoo func (UnimplementedCampusServer) GetRoomSchedule(context.Context, *GetRoomScheduleRequest) (*GetRoomScheduleReply, error) { return nil, status.Errorf(codes.Unimplemented, "method GetRoomSchedule not implemented") } -func (UnimplementedCampusServer) GetCafeteriaRatings(context.Context, *CafeteriaRatingRequest) (*CafeteriaRatingReply, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetCafeteriaRatings not implemented") +func (UnimplementedCampusServer) GetCanteenRatings(context.Context, *CanteenRatingRequest) (*CanteenRatingReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetCanteenRatings not implemented") } func (UnimplementedCampusServer) GetDishRatings(context.Context, *DishRatingRequest) (*DishRatingReply, error) { return nil, status.Errorf(codes.Unimplemented, "method GetDishRatings not implemented") } -func (UnimplementedCampusServer) NewCafeteriaRating(context.Context, *NewCafeteriaRatingRequest) (*emptypb.Empty, error) { - return nil, status.Errorf(codes.Unimplemented, "method NewCafeteriaRating not implemented") +func (UnimplementedCampusServer) NewCanteenRating(context.Context, *NewCanteenRatingRequest) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method NewCanteenRating not implemented") } func (UnimplementedCampusServer) NewDishRating(context.Context, *NewDishRatingRequest) (*emptypb.Empty, error) { return nil, status.Errorf(codes.Unimplemented, "method NewDishRating not implemented") @@ -529,11 +529,11 @@ func (UnimplementedCampusServer) GetAvailableDishTags(context.Context, *emptypb. func (UnimplementedCampusServer) GetNameTags(context.Context, *emptypb.Empty) (*GetTagsReply, error) { return nil, status.Errorf(codes.Unimplemented, "method GetNameTags not implemented") } -func (UnimplementedCampusServer) GetAvailableCafeteriaTags(context.Context, *emptypb.Empty) (*GetTagsReply, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetAvailableCafeteriaTags not implemented") +func (UnimplementedCampusServer) GetAvailableCanteenTags(context.Context, *emptypb.Empty) (*GetTagsReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetAvailableCanteenTags not implemented") } -func (UnimplementedCampusServer) GetCafeterias(context.Context, *emptypb.Empty) (*GetCafeteriaReply, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetCafeterias not implemented") +func (UnimplementedCampusServer) GetCanteens(context.Context, *emptypb.Empty) (*GetCanteenReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetCanteens not implemented") } func (UnimplementedCampusServer) GetDishes(context.Context, *GetDishesRequest) (*GetDishesReply, error) { return nil, status.Errorf(codes.Unimplemented, "method GetDishes not implemented") @@ -737,20 +737,20 @@ func _Campus_GetRoomSchedule_Handler(srv interface{}, ctx context.Context, dec f return interceptor(ctx, in, info, handler) } -func _Campus_GetCafeteriaRatings_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CafeteriaRatingRequest) +func _Campus_GetCanteenRatings_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CanteenRatingRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(CampusServer).GetCafeteriaRatings(ctx, in) + return srv.(CampusServer).GetCanteenRatings(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: Campus_GetCafeteriaRatings_FullMethodName, + FullMethod: Campus_GetCanteenRatings_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CampusServer).GetCafeteriaRatings(ctx, req.(*CafeteriaRatingRequest)) + return srv.(CampusServer).GetCanteenRatings(ctx, req.(*CanteenRatingRequest)) } return interceptor(ctx, in, info, handler) } @@ -773,20 +773,20 @@ func _Campus_GetDishRatings_Handler(srv interface{}, ctx context.Context, dec fu return interceptor(ctx, in, info, handler) } -func _Campus_NewCafeteriaRating_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(NewCafeteriaRatingRequest) +func _Campus_NewCanteenRating_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(NewCanteenRatingRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(CampusServer).NewCafeteriaRating(ctx, in) + return srv.(CampusServer).NewCanteenRating(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: Campus_NewCafeteriaRating_FullMethodName, + FullMethod: Campus_NewCanteenRating_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CampusServer).NewCafeteriaRating(ctx, req.(*NewCafeteriaRatingRequest)) + return srv.(CampusServer).NewCanteenRating(ctx, req.(*NewCanteenRatingRequest)) } return interceptor(ctx, in, info, handler) } @@ -845,38 +845,38 @@ func _Campus_GetNameTags_Handler(srv interface{}, ctx context.Context, dec func( return interceptor(ctx, in, info, handler) } -func _Campus_GetAvailableCafeteriaTags_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _Campus_GetAvailableCanteenTags_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(emptypb.Empty) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(CampusServer).GetAvailableCafeteriaTags(ctx, in) + return srv.(CampusServer).GetAvailableCanteenTags(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: Campus_GetAvailableCafeteriaTags_FullMethodName, + FullMethod: Campus_GetAvailableCanteenTags_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CampusServer).GetAvailableCafeteriaTags(ctx, req.(*emptypb.Empty)) + return srv.(CampusServer).GetAvailableCanteenTags(ctx, req.(*emptypb.Empty)) } return interceptor(ctx, in, info, handler) } -func _Campus_GetCafeterias_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _Campus_GetCanteens_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(emptypb.Empty) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(CampusServer).GetCafeterias(ctx, in) + return srv.(CampusServer).GetCanteens(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: Campus_GetCafeterias_FullMethodName, + FullMethod: Campus_GetCanteens_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CampusServer).GetCafeterias(ctx, req.(*emptypb.Empty)) + return srv.(CampusServer).GetCanteens(ctx, req.(*emptypb.Empty)) } return interceptor(ctx, in, info, handler) } @@ -1295,16 +1295,16 @@ var Campus_ServiceDesc = grpc.ServiceDesc{ Handler: _Campus_GetRoomSchedule_Handler, }, { - MethodName: "GetCafeteriaRatings", - Handler: _Campus_GetCafeteriaRatings_Handler, + MethodName: "GetCanteenRatings", + Handler: _Campus_GetCanteenRatings_Handler, }, { MethodName: "GetDishRatings", Handler: _Campus_GetDishRatings_Handler, }, { - MethodName: "NewCafeteriaRating", - Handler: _Campus_NewCafeteriaRating_Handler, + MethodName: "NewCanteenRating", + Handler: _Campus_NewCanteenRating_Handler, }, { MethodName: "NewDishRating", @@ -1319,12 +1319,12 @@ var Campus_ServiceDesc = grpc.ServiceDesc{ Handler: _Campus_GetNameTags_Handler, }, { - MethodName: "GetAvailableCafeteriaTags", - Handler: _Campus_GetAvailableCafeteriaTags_Handler, + MethodName: "GetAvailableCanteenTags", + Handler: _Campus_GetAvailableCanteenTags_Handler, }, { - MethodName: "GetCafeterias", - Handler: _Campus_GetCafeterias_Handler, + MethodName: "GetCanteens", + Handler: _Campus_GetCanteens_Handler, }, { MethodName: "GetDishes", diff --git a/server/backend/cafeteriaService.go b/server/backend/cafeteriaService.go index 9b1bb4c9..c70bd033 100644 --- a/server/backend/cafeteriaService.go +++ b/server/backend/cafeteriaService.go @@ -42,9 +42,9 @@ const ( // The parameter limit defines how many actual ratings should be returned. // The optional parameters from and to can define an interval in which the queried ratings have been stored. // If these aren't specified, the newest ratings will be returned as the default -func (s *CampusServer) GetCafeteriaRatings(_ context.Context, input *pb.CafeteriaRatingRequest) (*pb.CafeteriaRatingReply, error) { +func (s *CampusServer) GetCafeteriaRatings(_ context.Context, input *pb.CanteenRatingRequest) (*pb.CanteenRatingReply, error) { var result model.CafeteriaRatingAverage //get the average rating for this specific cafeteria - cafeteriaId := getIDForCafeteriaName(input.CafeteriaId, s.db) + cafeteriaId := getIDForCafeteriaName(input.CanteenId, s.db) res := s.db.Model(&model.CafeteriaRatingAverage{}). Where("cafeteriaId = ?", cafeteriaId). First(&result) @@ -58,7 +58,7 @@ func (s *CampusServer) GetCafeteriaRatings(_ context.Context, input *pb.Cafeteri ratings := queryLastCafeteriaRatingsWithLimit(input, cafeteriaId, s) cafeteriaTags := queryTags(s.db, cafeteriaId, -1, CAFETERIA) - return &pb.CafeteriaRatingReply{ + return &pb.CanteenRatingReply{ Avg: float64(result.Average), Std: float64(result.Std), Min: int32(result.Min), @@ -67,7 +67,7 @@ func (s *CampusServer) GetCafeteriaRatings(_ context.Context, input *pb.Cafeteri RatingTags: cafeteriaTags, }, nil } else { - return &pb.CafeteriaRatingReply{ + return &pb.CanteenRatingReply{ Avg: -1, Std: -1, Min: -1, @@ -78,7 +78,7 @@ func (s *CampusServer) GetCafeteriaRatings(_ context.Context, input *pb.Cafeteri // queryLastCafeteriaRatingsWithLimit // Queries the actual ratings for a cafeteria and attaches the tag ratings which belong to the ratings -func queryLastCafeteriaRatingsWithLimit(input *pb.CafeteriaRatingRequest, cafeteriaID int32, s *CampusServer) []*pb.SingleRatingReply { +func queryLastCafeteriaRatingsWithLimit(input *pb.CanteenRatingRequest, cafeteriaID int32, s *CampusServer) []*pb.SingleRatingReply { var ratings []model.CafeteriaRating var err error @@ -148,7 +148,7 @@ func queryLastCafeteriaRatingsWithLimit(input *pb.CafeteriaRatingRequest, cafete // If these aren't specified, the newest ratings will be returned as the default func (s *CampusServer) GetDishRatings(_ context.Context, input *pb.DishRatingRequest) (*pb.DishRatingReply, error) { var result model.DishRatingAverage //get the average rating for this specific dish - cafeteriaID := getIDForCafeteriaName(input.CafeteriaId, s.db) + cafeteriaID := getIDForCafeteriaName(input.CanteenId, s.db) dishID := getIDForDishName(input.Dish, cafeteriaID, s.db) err := s.db.Model(&model.DishRatingAverage{}). @@ -358,8 +358,8 @@ func queryTagRatingsOverviewForRating(s *CampusServer, dishID int32, ratingType // If one of the parameters is invalid, an error will be returned. Otherwise, the rating will be saved. // All rating tags which were given with the new rating are stored if they are valid tags, if at least one tag was // invalid, an error is returned, all valid ratings tags will be stored nevertheless. Either the german or the english name can be returned to successfully store tags -func (s *CampusServer) NewCafeteriaRating(_ context.Context, input *pb.NewCafeteriaRatingRequest) (*emptypb.Empty, error) { - cafeteriaID, errorRes := inputSanitizationForNewRatingElements(input.Points, input.Comment, input.CafeteriaId, s) +func (s *CampusServer) NewCafeteriaRating(_ context.Context, input *pb.NewCanteenRatingRequest) (*emptypb.Empty, error) { + cafeteriaID, errorRes := inputSanitizationForNewRatingElements(input.Points, input.Comment, input.CanteenId, s) if errorRes != nil { return nil, errorRes } @@ -442,7 +442,7 @@ func storeImage(path string, i []byte) (string, error) { // invalid, an error is returned, all valid ratings tags will be stored nevertheless. Either the german or the english name can be returned to successfully store tags func (s *CampusServer) NewDishRating(_ context.Context, input *pb.NewDishRatingRequest) (*emptypb.Empty, error) { - cafeteriaID, errorRes := inputSanitizationForNewRatingElements(input.Points, input.Comment, input.CafeteriaId, s) + cafeteriaID, errorRes := inputSanitizationForNewRatingElements(input.Points, input.Comment, input.CanteenId, s) if errorRes != nil { return nil, errorRes } @@ -676,8 +676,8 @@ func (s *CampusServer) GetAvailableCafeteriaTags(_ context.Context, _ *emptypb.E // GetCafeterias RPC endpoint // Returns all cafeterias with meta information which are available in the eat-api -func (s *CampusServer) GetCafeterias(_ context.Context, _ *emptypb.Empty) (*pb.GetCafeteriaReply, error) { - var result []*pb.Cafeteria +func (s *CampusServer) GetCafeterias(_ context.Context, _ *emptypb.Empty) (*pb.GetCanteenReply, error) { + var result []*pb.Canteen var requestStatus error = nil err := s.db.Model(&model.Cafeteria{}).Select("cafeteria as id,address,latitude,longitude").Scan(&result).Error if err != nil { @@ -685,8 +685,8 @@ func (s *CampusServer) GetCafeterias(_ context.Context, _ *emptypb.Empty) (*pb.G requestStatus = status.Error(codes.Internal, "Cafeterias could not be loaded from the database.") } - return &pb.GetCafeteriaReply{ - Cafeteria: result, + return &pb.GetCanteenReply{ + Canteen: result, }, requestStatus } @@ -708,7 +708,7 @@ func (s *CampusServer) GetDishes(_ context.Context, request *pb.GetDishesRequest Select("weekly.dishID"). Joins("JOIN dish d ON d.dish = weekly.dishID"). Joins("JOIN cafeteria c ON c.cafeteria = d.cafeteriaID"). - Where("c.name LIKE ?", request.CafeteriaId). + Where("c.name LIKE ?", request.CanteenId). Select("d.name"). Find(&results).Error