-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathrating.proto
More file actions
52 lines (42 loc) · 1.85 KB
/
Copy pathrating.proto
File metadata and controls
52 lines (42 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Aggregate drink ratings for the online "my festival" API.
syntax = "proto3";
package cambeerfestival.myfestival.v1;
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/protobuf/timestamp.proto";
// A single device's star rating for one drink at one festival.
//
// The resource id is the device (anonymous now, a signed-in user later), so a
// device has at most one rating per drink — updating it overwrites in place.
message Rating {
option (google.api.resource) = {
type: "myfestival.cambeerfestival.app/Rating"
pattern: "festivals/{festival}/drinks/{drink}/ratings/{device}"
singular: "rating"
plural: "ratings"
};
// Resource name: festivals/{festival}/drinks/{drink}/ratings/{device}.
string name = 1 [(google.api.field_behavior) = IDENTIFIER];
// The star rating, 1-5 inclusive.
int32 value = 2 [(google.api.field_behavior) = REQUIRED];
// When the rating was last set.
google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
}
// Computed, read-only aggregate of every device's rating for one drink.
//
// Keyed by drink under the festival so the whole festival can be listed in one
// paginated call for list/grid views.
message RatingSummary {
option (google.api.resource) = {
type: "myfestival.cambeerfestival.app/RatingSummary"
pattern: "festivals/{festival}/ratingSummaries/{drink}"
singular: "ratingSummary"
plural: "ratingSummaries"
};
// Resource name: festivals/{festival}/ratingSummaries/{drink}.
string name = 1 [(google.api.field_behavior) = IDENTIFIER];
// Number of ratings contributing to the average.
int32 rating_count = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
// Mean rating across all devices (1.0-5.0); 0 when there are no ratings.
double average_rating = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
}