productcatalog: longer product IDs

Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
This commit is contained in:
Ahmet Alp Balkan 2018-06-25 22:47:21 -07:00
parent 6268802ab5
commit 8a6be04035

View file

@ -18,63 +18,63 @@ var port = flag.Int("port", 3550, "port to listen at")
var catalog = []*pb.Product{
{
Id: "12",
Id: "OLJCESPC7Z",
Name: "Vintage Typewriter",
Description: "This typewriter looks good in your living room.",
Picture: "/static/img/products/typewriter.jpg",
PriceUsd: &pb.MoneyAmount{Decimal: 67, Fractional: 99},
},
{
Id: "14",
Id: "66VCHSJNUP",
Name: "Vintage Camera Lens",
Description: "You won't have a camera to use it and it probably doesn't work anyway.",
Picture: "/static/img/products/camera-lens.jpg",
PriceUsd: &pb.MoneyAmount{Decimal: 12, Fractional: 49},
},
{
Id: "22",
Id: "1YMWWN1N4O",
Name: "Home Barista Kit",
Description: "Always wanted to brew coffee with Chemex and Aeropress at home?",
Picture: "/static/img/products/barista-kit.jpg",
PriceUsd: &pb.MoneyAmount{Decimal: 124, Fractional: 0},
},
{
Id: "56",
Id: "L9ECAV7KIM",
Name: "Terrarium",
Description: "This terrarium will looks great in your white painted living room.",
Picture: "/static/img/products/terrarium.jpg",
PriceUsd: &pb.MoneyAmount{Decimal: 36, Fractional: 45},
},
{
Id: "50",
Id: "2ZYFJ3GM2N",
Name: "Film Camera",
Description: "This camera looks like it's a film camera, but it's actually digital.",
Picture: "/static/img/products/film-camera.jpg",
PriceUsd: &pb.MoneyAmount{Decimal: 2245, Fractional: 0},
},
{
Id: "44",
Id: "0PUK6V6EV0",
Name: "Vintage Record Player",
Description: "It still works.",
Picture: "/static/img/products/record-player.jpg",
PriceUsd: &pb.MoneyAmount{Decimal: 65, Fractional: 50},
},
{
Id: "52",
Id: "LS4PSXUNUM",
Name: "Metal Camping Mug",
Description: "You probably don't go camping that often but this is better than plastic cups.",
Picture: "/static/img/products/camp-mug.jpg",
PriceUsd: &pb.MoneyAmount{Decimal: 24, Fractional: 33},
},
{
Id: "49",
Id: "9SIQT8TOJO",
Name: "City Bike",
Description: "This single gear bike probably cannot climb the hills of San Francisco.",
Picture: "/static/img/products/city-bike.jpg",
PriceUsd: &pb.MoneyAmount{Decimal: 789, Fractional: 50},
},
{
Id: "97",
Id: "6E92ZMYYFZ",
Name: "Air Plant",
Description: "Have you ever wondered whether air plants need water? Buy one and figure out.",
Picture: "/static/img/products/air-plant.jpg",
@ -111,7 +111,7 @@ func (p *productCatalog) GetProduct(ctx context.Context, req *pb.GetProductReque
return p, nil
}
}
return nil, status.Errorf(codes.NotFound, "no product with ID %d", req.Id)
return nil, status.Errorf(codes.NotFound, "no product with ID %s", req.Id)
}
func (p *productCatalog) SearchProducts(ctx context.Context, req *pb.SearchProductsRequest) (*pb.SearchProductsResponse, error) {