adservice: find relevant ads by category (#61)
The ad service now returns ads matching the categories of the product that is currently displayed. Changes in this commit: - List all products' categories in products.json. - Pass the current product's categories from the frontend to the ad service when looking up ads. - Store a statically initialized multimap from product category to ad in the ad service. - Return all ads matching the given categories when handling an ads request. The ad service continues to return random ads when no categories are given or no ads match the categories.
This commit is contained in:
parent
86c8c06cc1
commit
dc7effd601
11 changed files with 1532 additions and 925 deletions
|
@ -64,6 +64,10 @@ message Product {
|
|||
string description = 3;
|
||||
string picture = 4;
|
||||
Money price_usd = 5;
|
||||
|
||||
// Categories such as "vintage" or "gardening" that can be used to look up
|
||||
// other related products.
|
||||
repeated string categories = 6;
|
||||
}
|
||||
|
||||
message ListProductsResponse {
|
||||
|
@ -218,18 +222,18 @@ message PlaceOrderResponse {
|
|||
OrderResult order = 1;
|
||||
}
|
||||
|
||||
// ------------Ads service------------------
|
||||
// ------------Ad service------------------
|
||||
|
||||
service AdsService {
|
||||
rpc GetAds(AdsRequest) returns (AdsResponse) {}
|
||||
service AdService {
|
||||
rpc GetAds(AdRequest) returns (AdResponse) {}
|
||||
}
|
||||
|
||||
message AdsRequest {
|
||||
message AdRequest {
|
||||
// List of important key words from the current page describing the context.
|
||||
repeated string context_keys = 1;
|
||||
}
|
||||
|
||||
message AdsResponse {
|
||||
message AdResponse {
|
||||
repeated Ad ads = 1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue