From d4eb98f65fb1cd59b88e184b7176fa52dbb6dd48 Mon Sep 17 00:00:00 2001 From: Maximilian Stiede Date: Thu, 13 Feb 2020 19:28:15 +0100 Subject: [PATCH 1/6] feat(food): add counter entity, add offer_title and examples in documentation --- hpi/cloud/food/v1test/food.proto | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/hpi/cloud/food/v1test/food.proto b/hpi/cloud/food/v1test/food.proto index 43226d2..ad4a45d 100644 --- a/hpi/cloud/food/v1test/food.proto +++ b/hpi/cloud/food/v1test/food.proto @@ -29,13 +29,16 @@ message MenuItem { // Required. The date of when this menu was/will be served. google.type.Date date = 3; - // The counter where this item is served. - string counter = 4; + // ID of the counter (location) where this item is served. + string counter_id = 4; // Required. The price to pay for this item, depending on the customer (e.g. student, guest, default ...). map prices = 5; - // Required. The title. + // Required. The title of the offer, e.g. "Offer 4", "Tagesessen" + string offer_title = 8; + + // Required. The title of the food, e.g. "Hamburger" string title = 6; // IDs of the labels of the item. @@ -53,3 +56,15 @@ message Label { // The URL pointing to an icon. string icon = 3; } + +// A counter for a menu item. +message Counter { + // Required, output only. The unique ID. + string id = 1; + + // Required. The title, e.g. "1", "Außengrill" + string title = 2; + + // The URL pointing to an icon. + string icon = 3; +} From e4b2142afa20241b5840a57c132fb8a6f14bd7b6 Mon Sep 17 00:00:00 2001 From: Jonas Wanke Date: Fri, 24 Jan 2020 14:51:27 +0100 Subject: [PATCH 2/6] build: fix gRPC-Java version (cherry picked from commit b595a3f0f6ccdd29451291cb0454c4b4c0f1c9ee) --- .travis.yml | 2 +- build.gradle | 6 +++--- gradle/wrapper/gradle-wrapper.properties | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4d90ea8..eb39b4b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,7 @@ script: - docker run --rm -v $(pwd):$(pwd) -w $(pwd) - thethingsindustries/protoc + thethingsindustries/protoc:3.1.18 --plugin=protoc-gen-grpc=/usr/bin/protoc-gen-grpc-java --java_out=./hpi-cloud-apis/src/main/java --grpc_out=./hpi-cloud-apis/src/main/java diff --git a/build.gradle b/build.gradle index a742105..3e18774 100644 --- a/build.gradle +++ b/build.gradle @@ -11,10 +11,10 @@ repositories { dependencies { api("com.google.protobuf:protobuf-java:3.8.0") // implementation as Android clients will replace this with grpc-protobuf-lite - implementation("io.grpc:grpc-protobuf:1.21.0") - api("io.grpc:grpc-stub:1.21.0") + implementation("io.grpc:grpc-protobuf:1.26.0") + api("io.grpc:grpc-stub:1.26.0") // implementation as Android clients will replace this with grpc-okhttp - implementation("io.grpc:grpc-netty:1.21.0") + implementation("io.grpc:grpc-netty:1.26.0") } // Publishing config diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b0acbdc..e0c4de3 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From d07ace6b4b06f008b1b7518eacd73c42f0faea73 Mon Sep 17 00:00:00 2001 From: Maximilian Stiede Date: Thu, 13 Feb 2020 19:42:39 +0100 Subject: [PATCH 3/6] feat(food): add restaurant_id to Counter --- hpi/cloud/food/v1test/food.proto | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hpi/cloud/food/v1test/food.proto b/hpi/cloud/food/v1test/food.proto index ad4a45d..f11ac03 100644 --- a/hpi/cloud/food/v1test/food.proto +++ b/hpi/cloud/food/v1test/food.proto @@ -62,6 +62,9 @@ message Counter { // Required, output only. The unique ID. string id = 1; + // Required. ID of the restaurant this counter belongs to. + string restaurant_id = 4; + // Required. The title, e.g. "1", "Außengrill" string title = 2; From 2ead4dd99e31105acfc4711515852996a94acf42 Mon Sep 17 00:00:00 2001 From: Maximilian Stiede Date: Thu, 13 Feb 2020 19:44:56 +0100 Subject: [PATCH 4/6] docs(food): fix comments --- hpi/cloud/food/v1test/food.proto | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hpi/cloud/food/v1test/food.proto b/hpi/cloud/food/v1test/food.proto index f11ac03..e4dabde 100644 --- a/hpi/cloud/food/v1test/food.proto +++ b/hpi/cloud/food/v1test/food.proto @@ -35,10 +35,10 @@ message MenuItem { // Required. The price to pay for this item, depending on the customer (e.g. student, guest, default ...). map prices = 5; - // Required. The title of the offer, e.g. "Offer 4", "Tagesessen" + // Required. The title of the offer, e.g. "Offer 4", "Tagesessen". string offer_title = 8; - // Required. The title of the food, e.g. "Hamburger" + // Required. The title of the MenuItem (specific food name), e.g. "Hamburger". string title = 6; // IDs of the labels of the item. @@ -65,7 +65,7 @@ message Counter { // Required. ID of the restaurant this counter belongs to. string restaurant_id = 4; - // Required. The title, e.g. "1", "Außengrill" + // Required. The title, e.g. "1", "Außengrill". string title = 2; // The URL pointing to an icon. From 7e39340f924c54870e25797e937398a8190be294 Mon Sep 17 00:00:00 2001 From: Maximilian Stiede Date: Thu, 13 Feb 2020 19:52:31 +0100 Subject: [PATCH 5/6] feat(food): add RPC methods and data types for the new Counter entity --- hpi/cloud/food/v1test/food_service.proto | 37 ++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/hpi/cloud/food/v1test/food_service.proto b/hpi/cloud/food/v1test/food_service.proto index 530ecdf..b786848 100644 --- a/hpi/cloud/food/v1test/food_service.proto +++ b/hpi/cloud/food/v1test/food_service.proto @@ -30,6 +30,13 @@ service FoodService { // Gets a label. rpc GetLabel (GetLabelRequest) returns (Label); + + + // Lists counters for a restaurant. + rpc ListCounters (ListCountersRequest) returns (ListCountersResponse); + + // Gets a counter. + rpc GetCounter (GetCounterRequest) returns (Counter); } // Request message for listing restaurants using [ListRestaurants][hpi.cloud.food.v1test.FoodService.ListRestaurants]. @@ -117,3 +124,33 @@ message GetLabelRequest { // Required. The label ID. string id = 1; } + + +// Request message for listing counters for a given restaurant using [ListCounters][hpi.cloud.food.v1test.FoodService.ListCounters]. +message ListCountersRequest { + // Required. ID of the restaurant the counters should be listed for. + string restaurant_id = 1; + + // The maximum number of labels to return in the response. + int32 page_size = 2; + + // A pagination token returned from a previous call to `ListLabels` + // that indicates where this listing should continue from. + string page_token = 3; +} + +// Response message for listing Counters using [ListCounters][hpi.cloud.food.v1test.FoodService.ListCounters]. +message ListCountersResponse { + // A possibly paginated list of counters. + repeated Counter Counters = 1; + + // Token to retrieve the next page of results, or empty if there are no + // more results. + string next_page_token = 2; +} + +// Request message for [GetCounter][hpi.cloud.food.v1test.FoodService.GetCounter]. +message GetCounterRequest { + // Required. The label ID. + string id = 1; +} From 0292b8bfee6a816bf0ed0cf66b18184e8aab2a37 Mon Sep 17 00:00:00 2001 From: Maximilian Stiede Date: Thu, 13 Feb 2020 20:31:50 +0100 Subject: [PATCH 6/6] fix(food): PR changes --- hpi/cloud/food/v1test/food.proto | 2 +- hpi/cloud/food/v1test/food_service.proto | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/hpi/cloud/food/v1test/food.proto b/hpi/cloud/food/v1test/food.proto index e4dabde..a6d9faf 100644 --- a/hpi/cloud/food/v1test/food.proto +++ b/hpi/cloud/food/v1test/food.proto @@ -59,7 +59,7 @@ message Label { // A counter for a menu item. message Counter { - // Required, output only. The unique ID. + // Required, output only. The unique ID (across restaurants). string id = 1; // Required. ID of the restaurant this counter belongs to. diff --git a/hpi/cloud/food/v1test/food_service.proto b/hpi/cloud/food/v1test/food_service.proto index b786848..e932925 100644 --- a/hpi/cloud/food/v1test/food_service.proto +++ b/hpi/cloud/food/v1test/food_service.proto @@ -128,15 +128,15 @@ message GetLabelRequest { // Request message for listing counters for a given restaurant using [ListCounters][hpi.cloud.food.v1test.FoodService.ListCounters]. message ListCountersRequest { - // Required. ID of the restaurant the counters should be listed for. - string restaurant_id = 1; - // The maximum number of labels to return in the response. - int32 page_size = 2; + int32 page_size = 1; // A pagination token returned from a previous call to `ListLabels` // that indicates where this listing should continue from. - string page_token = 3; + string page_token = 2; + + // Required. ID of the restaurant the counters should be listed for. + string restaurant_id = 3; } // Response message for listing Counters using [ListCounters][hpi.cloud.food.v1test.FoodService.ListCounters].