update cart
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Владимир Фёдоров 2024-05-30 03:54:12 +07:00
parent 323f50fb43
commit 073a7e6d8c
10 changed files with 207 additions and 163 deletions

View File

@ -37,9 +37,9 @@ service CRM {
body: "order" body: "order"
}; };
} }
rpc GetCard(CardReq) returns (CardRsp) { rpc GetCart(CartReq) returns (CartRsp) {
option (google.api.http) = { option (google.api.http) = {
post: "/card" post: "/cart"
body: "items" body: "items"
}; };
} }
@ -146,7 +146,7 @@ message OrderItem {
int64 count = 2; int64 count = 2;
} }
message CardItem { message CartItem {
int64 id = 1; int64 id = 1;
string article = 2; string article = 2;
string name = 3; string name = 3;
@ -161,12 +161,14 @@ message CardItem {
repeated Label labels = 14; repeated Label labels = 14;
} }
message CardReq { message CartReq {
repeated OrderItem items = 1; repeated OrderItem items = 1;
} }
message CardRsp { message CartRsp {
repeated CardItem items = 1; repeated CartItem items = 1;
int64 amount = 2;
int64 amountOld = 3;
} }
message GetImageReq { message GetImageReq {

View File

@ -1,10 +1,14 @@
POST http://localhost:8090/card POST http://localhost:8090/cart
content-type: application/json content-type: application/json
[ [
{ {
"product_id": 1, "product_id": 1,
"count": 7 "count": 7
},
{
"product_id": 20,
"count": 15
} }
] ]
@ -20,6 +24,10 @@ content-type: application/json
{ {
"product_id": 1, "product_id": 1,
"count": 7 "count": 7
},
{
"product_id": 20,
"count": 15
} }
] ]
} }

View File

@ -4,7 +4,7 @@ import (
"cake_crm/internal/app" "cake_crm/internal/app"
"cake_crm/internal/modules/messenger/telegram" "cake_crm/internal/modules/messenger/telegram"
"cake_crm/internal/modules/storage/storage_file" "cake_crm/internal/modules/storage/storage_file"
"cake_crm/internal/services/card" "cake_crm/internal/services/cart"
"cake_crm/internal/services/order" "cake_crm/internal/services/order"
proto "cake_crm/proto" proto "cake_crm/proto"
"context" "context"
@ -22,7 +22,7 @@ import (
func main() { func main() {
storage := storage_file.NewStorageFile() storage := storage_file.NewStorageFile()
cardService := card.NewService(storage) cartService := cart.NewService(storage)
orderService := order.NewService() orderService := order.NewService()
@ -55,7 +55,7 @@ func main() {
// Create a gRPC server object // Create a gRPC server object
s := grpc.NewServer() s := grpc.NewServer()
// Attach the Greeter service to the server // Attach the Greeter service to the server
proto.RegisterCRMServer(s, app.NewServer(storage, messenger, cardService, orderService)) proto.RegisterCRMServer(s, app.NewServer(storage, messenger, cartService, orderService))
// Serve gRPC server // Serve gRPC server
log.Println("Serving gRPC on 0.0.0.0:8080") log.Println("Serving gRPC on 0.0.0.0:8080")
go func() { go func() {

View File

@ -3,7 +3,7 @@ package app
import ( import (
"cake_crm/internal/modules/messenger" "cake_crm/internal/modules/messenger"
"cake_crm/internal/modules/storage" "cake_crm/internal/modules/storage"
"cake_crm/internal/services/card" "cake_crm/internal/services/cart"
"cake_crm/internal/services/order" "cake_crm/internal/services/order"
proto "cake_crm/proto" proto "cake_crm/proto"
"context" "context"
@ -16,20 +16,20 @@ type Server struct {
proto.UnsafeCRMServer proto.UnsafeCRMServer
storage storage.IStorage storage storage.IStorage
messenger messenger.IMessenger messenger messenger.IMessenger
cardService *card.Service cartService *cart.Service
orderService *order.Service orderService *order.Service
} }
func NewServer( func NewServer(
storage storage.IStorage, storage storage.IStorage,
messenger messenger.IMessenger, messenger messenger.IMessenger,
cardService *card.Service, cartService *cart.Service,
orderService *order.Service, orderService *order.Service,
) proto.CRMServer { ) proto.CRMServer {
return &Server{ return &Server{
storage: storage, storage: storage,
messenger: messenger, messenger: messenger,
cardService: cardService, cartService: cartService,
orderService: orderService, orderService: orderService,
} }
} }
@ -67,7 +67,7 @@ func (s *Server) GetBreadcrumbs(ctx context.Context, req *proto.GetBreadcrumbsRe
} }
func (s *Server) Order(ctx context.Context, req *proto.OrderReq) (*proto.OrderRsp, error) { func (s *Server) Order(ctx context.Context, req *proto.OrderReq) (*proto.OrderRsp, error) {
enrichItems, err := s.cardService.GetCard(ctx, req.Order.Items) enrichItems, err := s.cartService.GetCart(ctx, req.Order.Items)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -78,12 +78,12 @@ func (s *Server) Order(ctx context.Context, req *proto.OrderReq) (*proto.OrderRs
return &proto.OrderRsp{}, s.messenger.SendMessage(text) return &proto.OrderRsp{}, s.messenger.SendMessage(text)
} }
func (s *Server) GetCard(ctx context.Context, req *proto.CardReq) (*proto.CardRsp, error) { func (s *Server) GetCart(ctx context.Context, req *proto.CartReq) (*proto.CartRsp, error) {
enrichItems, err := s.cardService.GetCard(ctx, req.Items) resp, err := s.cartService.GetCart(ctx, req.Items)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return &proto.CardRsp{Items: enrichItems}, nil return resp, nil
} }
func (s *Server) GetImage(_ context.Context, req *proto.GetImageReq) (*httpbody.HttpBody, error) { func (s *Server) GetImage(_ context.Context, req *proto.GetImageReq) (*httpbody.HttpBody, error) {

View File

@ -1,4 +1,4 @@
package card package cart
import ( import (
"cake_crm/internal/modules/storage" "cake_crm/internal/modules/storage"
@ -23,8 +23,10 @@ func NewService(storage storage.IStorage) *Service {
} }
} }
func (s *Service) GetCard(ctx context.Context, items []*proto.OrderItem) ([]*proto.CardItem, error) { func (s *Service) GetCart(ctx context.Context, items []*proto.OrderItem) (*proto.CartRsp, error) {
res := make([]*proto.CardItem, 0, len(items)) var cartAmount int64
var cartAmountOld int64
res := make([]*proto.CartItem, 0, len(items))
for _, item := range items { for _, item := range items {
product, err := s.storage.GetProduct(ctx, item.ProductId) product, err := s.storage.GetProduct(ctx, item.ProductId)
if err != nil { if err != nil {
@ -41,7 +43,7 @@ func (s *Service) GetCard(ctx context.Context, items []*proto.OrderItem) ([]*pro
} }
res = append( res = append(
res, res,
&proto.CardItem{ &proto.CartItem{
Id: product.Id, Id: product.Id,
Article: product.Article, Article: product.Article,
Name: product.Name, Name: product.Name,
@ -56,8 +58,14 @@ func (s *Service) GetCard(ctx context.Context, items []*proto.OrderItem) ([]*pro
Labels: product.Labels, Labels: product.Labels,
}, },
) )
cartAmount += amount
cartAmountOld += amountOld
} }
return res, nil return &proto.CartRsp{
Items: res,
Amount: cartAmount,
AmountOld: cartAmountOld,
}, nil
} }
func calcItemAmount(item *ProductAndCount) (int64, int64, error) { func calcItemAmount(item *ProductAndCount) (int64, int64, error) {

View File

@ -13,12 +13,11 @@ func NewService() *Service {
return &Service{} return &Service{}
} }
func (s *Service) CreateOrderText(req *proto.OrderReq, items []*proto.CardItem) (string, error) { func (s *Service) CreateOrderText(req *proto.OrderReq, cart *proto.CartRsp) (string, error) {
buffer := bytes.Buffer{} buffer := bytes.Buffer{}
var orderAmount int64
buffer.WriteString(fmt.Sprintf("Заказ от:\n%s\n%s\n", req.Order.Name, req.Order.Phone)) buffer.WriteString(fmt.Sprintf("Заказ от:\n%s\n%s\n", req.Order.Name, req.Order.Phone))
buffer.WriteString("\n") buffer.WriteString("\n")
for _, item := range items { for _, item := range cart.Items {
buffer.WriteString(item.Name) buffer.WriteString(item.Name)
buffer.WriteString("\n") buffer.WriteString("\n")
unit, err := unitToText(item.Unit) unit, err := unitToText(item.Unit)
@ -26,12 +25,11 @@ func (s *Service) CreateOrderText(req *proto.OrderReq, items []*proto.CardItem)
return "", err return "", err
} }
buffer.WriteString(fmt.Sprintf("Количество: %d%s\n", item.Count, unit)) buffer.WriteString(fmt.Sprintf("Количество: %d%s\n", item.Count, unit))
orderAmount += item.Amount
buffer.WriteString(fmt.Sprintf("Сумма: %.00fр\n", float64(item.Amount)/100)) buffer.WriteString(fmt.Sprintf("Сумма: %.00fр\n", float64(item.Amount)/100))
buffer.WriteString("\n") buffer.WriteString("\n")
} }
buffer.WriteString("\n") buffer.WriteString("\n")
buffer.WriteString(fmt.Sprintf("ИТОГО: %.00fр\n", float64(orderAmount)/100)) buffer.WriteString(fmt.Sprintf("ИТОГО: %.00fр\n", float64(cart.Amount)/100))
return buffer.String(), nil return buffer.String(), nil
} }

View File

@ -1090,7 +1090,7 @@ func (x *OrderItem) GetCount() int64 {
return 0 return 0
} }
type CardItem struct { type CartItem struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
@ -1109,8 +1109,8 @@ type CardItem struct {
Labels []*Label `protobuf:"bytes,14,rep,name=labels,proto3" json:"labels,omitempty"` Labels []*Label `protobuf:"bytes,14,rep,name=labels,proto3" json:"labels,omitempty"`
} }
func (x *CardItem) Reset() { func (x *CartItem) Reset() {
*x = CardItem{} *x = CartItem{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_main_proto_msgTypes[19] mi := &file_main_proto_msgTypes[19]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -1118,13 +1118,13 @@ func (x *CardItem) Reset() {
} }
} }
func (x *CardItem) String() string { func (x *CartItem) String() string {
return protoimpl.X.MessageStringOf(x) return protoimpl.X.MessageStringOf(x)
} }
func (*CardItem) ProtoMessage() {} func (*CartItem) ProtoMessage() {}
func (x *CardItem) ProtoReflect() protoreflect.Message { func (x *CartItem) ProtoReflect() protoreflect.Message {
mi := &file_main_proto_msgTypes[19] mi := &file_main_proto_msgTypes[19]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -1136,96 +1136,96 @@ func (x *CardItem) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x) return mi.MessageOf(x)
} }
// Deprecated: Use CardItem.ProtoReflect.Descriptor instead. // Deprecated: Use CartItem.ProtoReflect.Descriptor instead.
func (*CardItem) Descriptor() ([]byte, []int) { func (*CartItem) Descriptor() ([]byte, []int) {
return file_main_proto_rawDescGZIP(), []int{19} return file_main_proto_rawDescGZIP(), []int{19}
} }
func (x *CardItem) GetId() int64 { func (x *CartItem) GetId() int64 {
if x != nil { if x != nil {
return x.Id return x.Id
} }
return 0 return 0
} }
func (x *CardItem) GetArticle() string { func (x *CartItem) GetArticle() string {
if x != nil { if x != nil {
return x.Article return x.Article
} }
return "" return ""
} }
func (x *CardItem) GetName() string { func (x *CartItem) GetName() string {
if x != nil { if x != nil {
return x.Name return x.Name
} }
return "" return ""
} }
func (x *CardItem) GetUri() string { func (x *CartItem) GetUri() string {
if x != nil { if x != nil {
return x.Uri return x.Uri
} }
return "" return ""
} }
func (x *CardItem) GetImages() []string { func (x *CartItem) GetImages() []string {
if x != nil { if x != nil {
return x.Images return x.Images
} }
return nil return nil
} }
func (x *CardItem) GetUnit() string { func (x *CartItem) GetUnit() string {
if x != nil { if x != nil {
return x.Unit return x.Unit
} }
return "" return ""
} }
func (x *CardItem) GetInventory() float64 { func (x *CartItem) GetInventory() float64 {
if x != nil { if x != nil {
return x.Inventory return x.Inventory
} }
return 0 return 0
} }
func (x *CardItem) GetCount() int64 { func (x *CartItem) GetCount() int64 {
if x != nil { if x != nil {
return x.Count return x.Count
} }
return 0 return 0
} }
func (x *CardItem) GetAmount() int64 { func (x *CartItem) GetAmount() int64 {
if x != nil { if x != nil {
return x.Amount return x.Amount
} }
return 0 return 0
} }
func (x *CardItem) GetAmountOld() int64 { func (x *CartItem) GetAmountOld() int64 {
if x != nil { if x != nil {
return x.AmountOld return x.AmountOld
} }
return 0 return 0
} }
func (x *CardItem) GetVariants() []*Variant { func (x *CartItem) GetVariants() []*Variant {
if x != nil { if x != nil {
return x.Variants return x.Variants
} }
return nil return nil
} }
func (x *CardItem) GetLabels() []*Label { func (x *CartItem) GetLabels() []*Label {
if x != nil { if x != nil {
return x.Labels return x.Labels
} }
return nil return nil
} }
type CardReq struct { type CartReq struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
@ -1233,8 +1233,8 @@ type CardReq struct {
Items []*OrderItem `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"` Items []*OrderItem `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"`
} }
func (x *CardReq) Reset() { func (x *CartReq) Reset() {
*x = CardReq{} *x = CartReq{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_main_proto_msgTypes[20] mi := &file_main_proto_msgTypes[20]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -1242,13 +1242,13 @@ func (x *CardReq) Reset() {
} }
} }
func (x *CardReq) String() string { func (x *CartReq) String() string {
return protoimpl.X.MessageStringOf(x) return protoimpl.X.MessageStringOf(x)
} }
func (*CardReq) ProtoMessage() {} func (*CartReq) ProtoMessage() {}
func (x *CardReq) ProtoReflect() protoreflect.Message { func (x *CartReq) ProtoReflect() protoreflect.Message {
mi := &file_main_proto_msgTypes[20] mi := &file_main_proto_msgTypes[20]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -1260,28 +1260,30 @@ func (x *CardReq) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x) return mi.MessageOf(x)
} }
// Deprecated: Use CardReq.ProtoReflect.Descriptor instead. // Deprecated: Use CartReq.ProtoReflect.Descriptor instead.
func (*CardReq) Descriptor() ([]byte, []int) { func (*CartReq) Descriptor() ([]byte, []int) {
return file_main_proto_rawDescGZIP(), []int{20} return file_main_proto_rawDescGZIP(), []int{20}
} }
func (x *CardReq) GetItems() []*OrderItem { func (x *CartReq) GetItems() []*OrderItem {
if x != nil { if x != nil {
return x.Items return x.Items
} }
return nil return nil
} }
type CardRsp struct { type CartRsp struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
Items []*CardItem `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"` Items []*CartItem `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"`
Amount int64 `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"`
AmountOld int64 `protobuf:"varint,3,opt,name=amountOld,proto3" json:"amountOld,omitempty"`
} }
func (x *CardRsp) Reset() { func (x *CartRsp) Reset() {
*x = CardRsp{} *x = CartRsp{}
if protoimpl.UnsafeEnabled { if protoimpl.UnsafeEnabled {
mi := &file_main_proto_msgTypes[21] mi := &file_main_proto_msgTypes[21]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -1289,13 +1291,13 @@ func (x *CardRsp) Reset() {
} }
} }
func (x *CardRsp) String() string { func (x *CartRsp) String() string {
return protoimpl.X.MessageStringOf(x) return protoimpl.X.MessageStringOf(x)
} }
func (*CardRsp) ProtoMessage() {} func (*CartRsp) ProtoMessage() {}
func (x *CardRsp) ProtoReflect() protoreflect.Message { func (x *CartRsp) ProtoReflect() protoreflect.Message {
mi := &file_main_proto_msgTypes[21] mi := &file_main_proto_msgTypes[21]
if protoimpl.UnsafeEnabled && x != nil { if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -1307,18 +1309,32 @@ func (x *CardRsp) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x) return mi.MessageOf(x)
} }
// Deprecated: Use CardRsp.ProtoReflect.Descriptor instead. // Deprecated: Use CartRsp.ProtoReflect.Descriptor instead.
func (*CardRsp) Descriptor() ([]byte, []int) { func (*CartRsp) Descriptor() ([]byte, []int) {
return file_main_proto_rawDescGZIP(), []int{21} return file_main_proto_rawDescGZIP(), []int{21}
} }
func (x *CardRsp) GetItems() []*CardItem { func (x *CartRsp) GetItems() []*CartItem {
if x != nil { if x != nil {
return x.Items return x.Items
} }
return nil return nil
} }
func (x *CartRsp) GetAmount() int64 {
if x != nil {
return x.Amount
}
return 0
}
func (x *CartRsp) GetAmountOld() int64 {
if x != nil {
return x.AmountOld
}
return 0
}
type GetImageReq struct { type GetImageReq struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
@ -1472,7 +1488,7 @@ var file_main_proto_rawDesc = []byte{
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74,
0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28,
0x03, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xca, 0x02, 0x0a, 0x08, 0x43, 0x61, 0x72, 0x03, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xca, 0x02, 0x0a, 0x08, 0x43, 0x61, 0x72,
0x64, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x74, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x72, 0x74, 0x69, 0x63, 0x6c, 0x65, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x72, 0x74, 0x69, 0x63, 0x6c, 0x65,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x72, 0x74, 0x69, 0x63, 0x6c, 0x65, 0x12, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x72, 0x74, 0x69, 0x63, 0x6c, 0x65, 0x12,
0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e,
@ -1492,55 +1508,59 @@ var file_main_proto_rawDesc = []byte{
0x74, 0x52, 0x08, 0x76, 0x61, 0x72, 0x69, 0x61, 0x6e, 0x74, 0x73, 0x12, 0x28, 0x0a, 0x06, 0x6c, 0x74, 0x52, 0x08, 0x76, 0x61, 0x72, 0x69, 0x61, 0x6e, 0x74, 0x73, 0x12, 0x28, 0x0a, 0x06, 0x6c,
0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x0e, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x0e, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x72,
0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, 0x06, 0x6c, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, 0x06, 0x6c,
0x61, 0x62, 0x65, 0x6c, 0x73, 0x22, 0x35, 0x0a, 0x07, 0x43, 0x61, 0x72, 0x64, 0x52, 0x65, 0x71, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x22, 0x35, 0x0a, 0x07, 0x43, 0x61, 0x72, 0x74, 0x52, 0x65, 0x71,
0x12, 0x2a, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2a, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x14, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x14, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x4f, 0x72, 0x64, 0x65,
0x72, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x22, 0x34, 0x0a, 0x07, 0x72, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x22, 0x6a, 0x0a, 0x07,
0x43, 0x61, 0x72, 0x64, 0x52, 0x73, 0x70, 0x12, 0x29, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x43, 0x61, 0x72, 0x74, 0x52, 0x73, 0x70, 0x12, 0x29, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73,
0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63,
0x72, 0x6d, 0x2e, 0x43, 0x61, 0x72, 0x64, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x05, 0x69, 0x74, 0x65, 0x72, 0x6d, 0x2e, 0x43, 0x61, 0x72, 0x74, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x05, 0x69, 0x74, 0x65,
0x6d, 0x73, 0x22, 0x21, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x65, 0x6d, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01,
0x71, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x28, 0x03, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x6d,
0x04, 0x6e, 0x61, 0x6d, 0x65, 0x32, 0xe0, 0x04, 0x0a, 0x03, 0x43, 0x52, 0x4d, 0x12, 0x4f, 0x0a, 0x6f, 0x75, 0x6e, 0x74, 0x4f, 0x6c, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x61,
0x0a, 0x47, 0x65, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x18, 0x2e, 0x63, 0x72, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x4f, 0x6c, 0x64, 0x22, 0x21, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x49,
0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18,
0x6f, 0x67, 0x52, 0x65, 0x71, 0x1a, 0x15, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x32, 0xe0, 0x04, 0x0a, 0x03,
0x6d, 0x2e, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x73, 0x70, 0x22, 0x10, 0x82, 0xd3, 0x43, 0x52, 0x4d, 0x12, 0x4f, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f,
0xe4, 0x93, 0x02, 0x0a, 0x12, 0x08, 0x2f, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x5c, 0x67, 0x12, 0x18, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x47, 0x65,
0x0a, 0x0c, 0x47, 0x65, 0x74, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1a, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x1a, 0x15, 0x2e, 0x63, 0x72,
0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x6f, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52,
0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x17, 0x2e, 0x63, 0x72, 0x61, 0x73, 0x70, 0x22, 0x10, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0a, 0x12, 0x08, 0x2f, 0x63, 0x61, 0x74,
0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x5c, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x50, 0x6f, 0x73, 0x69, 0x74,
0x52, 0x73, 0x70, 0x22, 0x17, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x11, 0x12, 0x0f, 0x2f, 0x70, 0x6f, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1a, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d,
0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x12, 0x55, 0x0a, 0x0a, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71,
0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x12, 0x18, 0x2e, 0x63, 0x72, 0x61, 0x1a, 0x17, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x50, 0x6f, 0x73,
0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x73, 0x70, 0x22, 0x17, 0x82, 0xd3, 0xe4, 0x93, 0x02,
0x74, 0x52, 0x65, 0x71, 0x1a, 0x15, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x11, 0x12, 0x0f, 0x2f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x7b, 0x69,
0x2e, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x73, 0x70, 0x22, 0x16, 0x82, 0xd3, 0xe4, 0x64, 0x7d, 0x12, 0x55, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74,
0x93, 0x02, 0x10, 0x12, 0x0e, 0x2f, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x73, 0x2f, 0x7b, 0x12, 0x18, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x47, 0x65, 0x74,
0x69, 0x64, 0x7d, 0x12, 0x6d, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x42, 0x72, 0x65, 0x61, 0x64, 0x63, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x15, 0x2e, 0x63, 0x72, 0x61,
0x72, 0x75, 0x6d, 0x62, 0x73, 0x12, 0x1c, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x73,
0x6d, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x72, 0x65, 0x61, 0x64, 0x63, 0x72, 0x75, 0x6d, 0x62, 0x73, 0x70, 0x22, 0x16, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x10, 0x12, 0x0e, 0x2f, 0x70, 0x72, 0x6f, 0x64,
0x52, 0x65, 0x71, 0x1a, 0x19, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x75, 0x63, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x12, 0x6d, 0x0a, 0x0e, 0x47, 0x65, 0x74,
0x42, 0x72, 0x65, 0x61, 0x64, 0x63, 0x72, 0x75, 0x6d, 0x62, 0x73, 0x52, 0x73, 0x70, 0x22, 0x22, 0x42, 0x72, 0x65, 0x61, 0x64, 0x63, 0x72, 0x75, 0x6d, 0x62, 0x73, 0x12, 0x1c, 0x2e, 0x63, 0x72,
0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1c, 0x12, 0x1a, 0x2f, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x72, 0x65, 0x61, 0x64,
0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x2f, 0x62, 0x72, 0x65, 0x61, 0x64, 0x63, 0x72, 0x75, 0x6d, 0x63, 0x72, 0x75, 0x6d, 0x62, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x19, 0x2e, 0x63, 0x72, 0x61, 0x62,
0x62, 0x73, 0x12, 0x49, 0x0a, 0x05, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x13, 0x2e, 0x63, 0x72, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x42, 0x72, 0x65, 0x61, 0x64, 0x63, 0x72, 0x75, 0x6d, 0x62,
0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x73, 0x52, 0x73, 0x70, 0x22, 0x22, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1c, 0x12, 0x1a, 0x2f, 0x70,
0x1a, 0x13, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x4f, 0x72, 0x64, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x2f, 0x62, 0x72, 0x65,
0x65, 0x72, 0x52, 0x73, 0x70, 0x22, 0x16, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x10, 0x3a, 0x05, 0x6f, 0x61, 0x64, 0x63, 0x72, 0x75, 0x6d, 0x62, 0x73, 0x12, 0x49, 0x0a, 0x05, 0x4f, 0x72, 0x64, 0x65,
0x72, 0x64, 0x65, 0x72, 0x22, 0x07, 0x2f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x73, 0x12, 0x47, 0x0a, 0x72, 0x12, 0x13, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x4f, 0x72,
0x07, 0x47, 0x65, 0x74, 0x43, 0x61, 0x72, 0x64, 0x12, 0x12, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, 0x13, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63,
0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x43, 0x61, 0x72, 0x64, 0x52, 0x65, 0x71, 0x1a, 0x12, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x73, 0x70, 0x22, 0x16, 0x82, 0xd3, 0xe4,
0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x43, 0x61, 0x72, 0x64, 0x52, 0x73, 0x70, 0x93, 0x02, 0x10, 0x3a, 0x05, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x22, 0x07, 0x2f, 0x6f, 0x72, 0x64,
0x22, 0x14, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0e, 0x3a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x22, 0x65, 0x72, 0x73, 0x12, 0x47, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x43, 0x61, 0x72, 0x74, 0x12, 0x12,
0x05, 0x2f, 0x63, 0x61, 0x72, 0x64, 0x12, 0x50, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x49, 0x6d, 0x61, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x43, 0x61, 0x72, 0x74, 0x52,
0x67, 0x65, 0x12, 0x16, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x47, 0x65, 0x71, 0x1a, 0x12, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x43,
0x65, 0x74, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x61, 0x72, 0x74, 0x52, 0x73, 0x70, 0x22, 0x14, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0e, 0x3a, 0x05,
0x67, 0x6c, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x48, 0x74, 0x74, 0x70, 0x42, 0x6f, 0x64, 0x79, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x22, 0x05, 0x2f, 0x63, 0x61, 0x72, 0x74, 0x12, 0x50, 0x0a, 0x08,
0x22, 0x16, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x10, 0x12, 0x0e, 0x2f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x47, 0x65, 0x74, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x12, 0x16, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73,
0x73, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x42, 0x0e, 0x92, 0x41, 0x00, 0x5a, 0x09, 0x70, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71,
0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x1a, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x48, 0x74,
0x74, 0x70, 0x42, 0x6f, 0x64, 0x79, 0x22, 0x16, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x10, 0x12, 0x0e,
0x2f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x73, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x42, 0x0e,
0x92, 0x41, 0x00, 0x5a, 0x09, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (
@ -1576,9 +1596,9 @@ var file_main_proto_goTypes = []interface{}{
(*OrderRsp)(nil), // 16: crabs.crm.OrderRsp (*OrderRsp)(nil), // 16: crabs.crm.OrderRsp
(*Order)(nil), // 17: crabs.crm.Order (*Order)(nil), // 17: crabs.crm.Order
(*OrderItem)(nil), // 18: crabs.crm.OrderItem (*OrderItem)(nil), // 18: crabs.crm.OrderItem
(*CardItem)(nil), // 19: crabs.crm.CardItem (*CartItem)(nil), // 19: crabs.crm.CartItem
(*CardReq)(nil), // 20: crabs.crm.CardReq (*CartReq)(nil), // 20: crabs.crm.CartReq
(*CardRsp)(nil), // 21: crabs.crm.CardRsp (*CartRsp)(nil), // 21: crabs.crm.CartRsp
(*GetImageReq)(nil), // 22: crabs.crm.GetImageReq (*GetImageReq)(nil), // 22: crabs.crm.GetImageReq
(*httpbody.HttpBody)(nil), // 23: google.api.HttpBody (*httpbody.HttpBody)(nil), // 23: google.api.HttpBody
} }
@ -1595,23 +1615,23 @@ var file_main_proto_depIdxs = []int32{
2, // 9: crabs.crm.BreadcrumbsRsp.categories:type_name -> crabs.crm.Category 2, // 9: crabs.crm.BreadcrumbsRsp.categories:type_name -> crabs.crm.Category
17, // 10: crabs.crm.OrderReq.order:type_name -> crabs.crm.Order 17, // 10: crabs.crm.OrderReq.order:type_name -> crabs.crm.Order
18, // 11: crabs.crm.Order.items:type_name -> crabs.crm.OrderItem 18, // 11: crabs.crm.Order.items:type_name -> crabs.crm.OrderItem
7, // 12: crabs.crm.CardItem.variants:type_name -> crabs.crm.Variant 7, // 12: crabs.crm.CartItem.variants:type_name -> crabs.crm.Variant
10, // 13: crabs.crm.CardItem.labels:type_name -> crabs.crm.Label 10, // 13: crabs.crm.CartItem.labels:type_name -> crabs.crm.Label
18, // 14: crabs.crm.CardReq.items:type_name -> crabs.crm.OrderItem 18, // 14: crabs.crm.CartReq.items:type_name -> crabs.crm.OrderItem
19, // 15: crabs.crm.CardRsp.items:type_name -> crabs.crm.CardItem 19, // 15: crabs.crm.CartRsp.items:type_name -> crabs.crm.CartItem
0, // 16: crabs.crm.CRM.GetCatalog:input_type -> crabs.crm.GetCatalogReq 0, // 16: crabs.crm.CRM.GetCatalog:input_type -> crabs.crm.GetCatalogReq
3, // 17: crabs.crm.CRM.GetPositions:input_type -> crabs.crm.GetPositionsReq 3, // 17: crabs.crm.CRM.GetPositions:input_type -> crabs.crm.GetPositionsReq
11, // 18: crabs.crm.CRM.GetProduct:input_type -> crabs.crm.GetProductReq 11, // 18: crabs.crm.CRM.GetProduct:input_type -> crabs.crm.GetProductReq
13, // 19: crabs.crm.CRM.GetBreadcrumbs:input_type -> crabs.crm.GetBreadcrumbsReq 13, // 19: crabs.crm.CRM.GetBreadcrumbs:input_type -> crabs.crm.GetBreadcrumbsReq
15, // 20: crabs.crm.CRM.Order:input_type -> crabs.crm.OrderReq 15, // 20: crabs.crm.CRM.Order:input_type -> crabs.crm.OrderReq
20, // 21: crabs.crm.CRM.GetCard:input_type -> crabs.crm.CardReq 20, // 21: crabs.crm.CRM.GetCart:input_type -> crabs.crm.CartReq
22, // 22: crabs.crm.CRM.GetImage:input_type -> crabs.crm.GetImageReq 22, // 22: crabs.crm.CRM.GetImage:input_type -> crabs.crm.GetImageReq
1, // 23: crabs.crm.CRM.GetCatalog:output_type -> crabs.crm.CatalogRsp 1, // 23: crabs.crm.CRM.GetCatalog:output_type -> crabs.crm.CatalogRsp
4, // 24: crabs.crm.CRM.GetPositions:output_type -> crabs.crm.PositionsRsp 4, // 24: crabs.crm.CRM.GetPositions:output_type -> crabs.crm.PositionsRsp
12, // 25: crabs.crm.CRM.GetProduct:output_type -> crabs.crm.ProductRsp 12, // 25: crabs.crm.CRM.GetProduct:output_type -> crabs.crm.ProductRsp
14, // 26: crabs.crm.CRM.GetBreadcrumbs:output_type -> crabs.crm.BreadcrumbsRsp 14, // 26: crabs.crm.CRM.GetBreadcrumbs:output_type -> crabs.crm.BreadcrumbsRsp
16, // 27: crabs.crm.CRM.Order:output_type -> crabs.crm.OrderRsp 16, // 27: crabs.crm.CRM.Order:output_type -> crabs.crm.OrderRsp
21, // 28: crabs.crm.CRM.GetCard:output_type -> crabs.crm.CardRsp 21, // 28: crabs.crm.CRM.GetCart:output_type -> crabs.crm.CartRsp
23, // 29: crabs.crm.CRM.GetImage:output_type -> google.api.HttpBody 23, // 29: crabs.crm.CRM.GetImage:output_type -> google.api.HttpBody
23, // [23:30] is the sub-list for method output_type 23, // [23:30] is the sub-list for method output_type
16, // [16:23] is the sub-list for method input_type 16, // [16:23] is the sub-list for method input_type
@ -1855,7 +1875,7 @@ func file_main_proto_init() {
} }
} }
file_main_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { file_main_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CardItem); i { switch v := v.(*CartItem); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@ -1867,7 +1887,7 @@ func file_main_proto_init() {
} }
} }
file_main_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { file_main_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CardReq); i { switch v := v.(*CartReq); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:
@ -1879,7 +1899,7 @@ func file_main_proto_init() {
} }
} }
file_main_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { file_main_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CardRsp); i { switch v := v.(*CartRsp); i {
case 0: case 0:
return &v.state return &v.state
case 1: case 1:

View File

@ -231,28 +231,28 @@ func local_request_CRM_Order_0(ctx context.Context, marshaler runtime.Marshaler,
} }
func request_CRM_GetCard_0(ctx context.Context, marshaler runtime.Marshaler, client CRMClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { func request_CRM_GetCart_0(ctx context.Context, marshaler runtime.Marshaler, client CRMClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq CardReq var protoReq CartReq
var metadata runtime.ServerMetadata var metadata runtime.ServerMetadata
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Items); err != nil && err != io.EOF { if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Items); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
} }
msg, err := client.GetCard(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) msg, err := client.GetCart(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err return msg, metadata, err
} }
func local_request_CRM_GetCard_0(ctx context.Context, marshaler runtime.Marshaler, server CRMServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { func local_request_CRM_GetCart_0(ctx context.Context, marshaler runtime.Marshaler, server CRMServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq CardReq var protoReq CartReq
var metadata runtime.ServerMetadata var metadata runtime.ServerMetadata
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Items); err != nil && err != io.EOF { if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Items); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
} }
msg, err := server.GetCard(ctx, &protoReq) msg, err := server.GetCart(ctx, &protoReq)
return msg, metadata, err return msg, metadata, err
} }
@ -440,7 +440,7 @@ func RegisterCRMHandlerServer(ctx context.Context, mux *runtime.ServeMux, server
}) })
mux.Handle("POST", pattern_CRM_GetCard_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { mux.Handle("POST", pattern_CRM_GetCart_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context()) ctx, cancel := context.WithCancel(req.Context())
defer cancel() defer cancel()
var stream runtime.ServerTransportStream var stream runtime.ServerTransportStream
@ -448,12 +448,12 @@ func RegisterCRMHandlerServer(ctx context.Context, mux *runtime.ServeMux, server
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error var err error
var annotatedContext context.Context var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/crabs.crm.CRM/GetCard", runtime.WithHTTPPathPattern("/card")) annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/crabs.crm.CRM/GetCart", runtime.WithHTTPPathPattern("/cart"))
if err != nil { if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return return
} }
resp, md, err := local_request_CRM_GetCard_0(annotatedContext, inboundMarshaler, server, req, pathParams) resp, md, err := local_request_CRM_GetCart_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil { if err != nil {
@ -461,7 +461,7 @@ func RegisterCRMHandlerServer(ctx context.Context, mux *runtime.ServeMux, server
return return
} }
forward_CRM_GetCard_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) forward_CRM_GetCart_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
}) })
@ -641,25 +641,25 @@ func RegisterCRMHandlerClient(ctx context.Context, mux *runtime.ServeMux, client
}) })
mux.Handle("POST", pattern_CRM_GetCard_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { mux.Handle("POST", pattern_CRM_GetCart_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context()) ctx, cancel := context.WithCancel(req.Context())
defer cancel() defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error var err error
var annotatedContext context.Context var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/crabs.crm.CRM/GetCard", runtime.WithHTTPPathPattern("/card")) annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/crabs.crm.CRM/GetCart", runtime.WithHTTPPathPattern("/cart"))
if err != nil { if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return return
} }
resp, md, err := request_CRM_GetCard_0(annotatedContext, inboundMarshaler, client, req, pathParams) resp, md, err := request_CRM_GetCart_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil { if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return return
} }
forward_CRM_GetCard_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) forward_CRM_GetCart_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
}) })
@ -699,7 +699,7 @@ var (
pattern_CRM_Order_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"orders"}, "")) pattern_CRM_Order_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"orders"}, ""))
pattern_CRM_GetCard_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"card"}, "")) pattern_CRM_GetCart_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"cart"}, ""))
pattern_CRM_GetImage_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1}, []string{"images", "name"}, "")) pattern_CRM_GetImage_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1}, []string{"images", "name"}, ""))
) )
@ -715,7 +715,7 @@ var (
forward_CRM_Order_0 = runtime.ForwardResponseMessage forward_CRM_Order_0 = runtime.ForwardResponseMessage
forward_CRM_GetCard_0 = runtime.ForwardResponseMessage forward_CRM_GetCart_0 = runtime.ForwardResponseMessage
forward_CRM_GetImage_0 = runtime.ForwardResponseMessage forward_CRM_GetImage_0 = runtime.ForwardResponseMessage
) )

View File

@ -25,7 +25,7 @@ const (
CRM_GetProduct_FullMethodName = "/crabs.crm.CRM/GetProduct" CRM_GetProduct_FullMethodName = "/crabs.crm.CRM/GetProduct"
CRM_GetBreadcrumbs_FullMethodName = "/crabs.crm.CRM/GetBreadcrumbs" CRM_GetBreadcrumbs_FullMethodName = "/crabs.crm.CRM/GetBreadcrumbs"
CRM_Order_FullMethodName = "/crabs.crm.CRM/Order" CRM_Order_FullMethodName = "/crabs.crm.CRM/Order"
CRM_GetCard_FullMethodName = "/crabs.crm.CRM/GetCard" CRM_GetCart_FullMethodName = "/crabs.crm.CRM/GetCart"
CRM_GetImage_FullMethodName = "/crabs.crm.CRM/GetImage" CRM_GetImage_FullMethodName = "/crabs.crm.CRM/GetImage"
) )
@ -38,7 +38,7 @@ type CRMClient interface {
GetProduct(ctx context.Context, in *GetProductReq, opts ...grpc.CallOption) (*ProductRsp, error) GetProduct(ctx context.Context, in *GetProductReq, opts ...grpc.CallOption) (*ProductRsp, error)
GetBreadcrumbs(ctx context.Context, in *GetBreadcrumbsReq, opts ...grpc.CallOption) (*BreadcrumbsRsp, error) GetBreadcrumbs(ctx context.Context, in *GetBreadcrumbsReq, opts ...grpc.CallOption) (*BreadcrumbsRsp, error)
Order(ctx context.Context, in *OrderReq, opts ...grpc.CallOption) (*OrderRsp, error) Order(ctx context.Context, in *OrderReq, opts ...grpc.CallOption) (*OrderRsp, error)
GetCard(ctx context.Context, in *CardReq, opts ...grpc.CallOption) (*CardRsp, error) GetCart(ctx context.Context, in *CartReq, opts ...grpc.CallOption) (*CartRsp, error)
GetImage(ctx context.Context, in *GetImageReq, opts ...grpc.CallOption) (*httpbody.HttpBody, error) GetImage(ctx context.Context, in *GetImageReq, opts ...grpc.CallOption) (*httpbody.HttpBody, error)
} }
@ -95,9 +95,9 @@ func (c *cRMClient) Order(ctx context.Context, in *OrderReq, opts ...grpc.CallOp
return out, nil return out, nil
} }
func (c *cRMClient) GetCard(ctx context.Context, in *CardReq, opts ...grpc.CallOption) (*CardRsp, error) { func (c *cRMClient) GetCart(ctx context.Context, in *CartReq, opts ...grpc.CallOption) (*CartRsp, error) {
out := new(CardRsp) out := new(CartRsp)
err := c.cc.Invoke(ctx, CRM_GetCard_FullMethodName, in, out, opts...) err := c.cc.Invoke(ctx, CRM_GetCart_FullMethodName, in, out, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -122,7 +122,7 @@ type CRMServer interface {
GetProduct(context.Context, *GetProductReq) (*ProductRsp, error) GetProduct(context.Context, *GetProductReq) (*ProductRsp, error)
GetBreadcrumbs(context.Context, *GetBreadcrumbsReq) (*BreadcrumbsRsp, error) GetBreadcrumbs(context.Context, *GetBreadcrumbsReq) (*BreadcrumbsRsp, error)
Order(context.Context, *OrderReq) (*OrderRsp, error) Order(context.Context, *OrderReq) (*OrderRsp, error)
GetCard(context.Context, *CardReq) (*CardRsp, error) GetCart(context.Context, *CartReq) (*CartRsp, error)
GetImage(context.Context, *GetImageReq) (*httpbody.HttpBody, error) GetImage(context.Context, *GetImageReq) (*httpbody.HttpBody, error)
mustEmbedUnimplementedCRMServer() mustEmbedUnimplementedCRMServer()
} }
@ -146,8 +146,8 @@ func (UnimplementedCRMServer) GetBreadcrumbs(context.Context, *GetBreadcrumbsReq
func (UnimplementedCRMServer) Order(context.Context, *OrderReq) (*OrderRsp, error) { func (UnimplementedCRMServer) Order(context.Context, *OrderReq) (*OrderRsp, error) {
return nil, status.Errorf(codes.Unimplemented, "method Order not implemented") return nil, status.Errorf(codes.Unimplemented, "method Order not implemented")
} }
func (UnimplementedCRMServer) GetCard(context.Context, *CardReq) (*CardRsp, error) { func (UnimplementedCRMServer) GetCart(context.Context, *CartReq) (*CartRsp, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetCard not implemented") return nil, status.Errorf(codes.Unimplemented, "method GetCart not implemented")
} }
func (UnimplementedCRMServer) GetImage(context.Context, *GetImageReq) (*httpbody.HttpBody, error) { func (UnimplementedCRMServer) GetImage(context.Context, *GetImageReq) (*httpbody.HttpBody, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetImage not implemented") return nil, status.Errorf(codes.Unimplemented, "method GetImage not implemented")
@ -255,20 +255,20 @@ func _CRM_Order_Handler(srv interface{}, ctx context.Context, dec func(interface
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _CRM_GetCard_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { func _CRM_GetCart_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CardReq) in := new(CartReq)
if err := dec(in); err != nil { if err := dec(in); err != nil {
return nil, err return nil, err
} }
if interceptor == nil { if interceptor == nil {
return srv.(CRMServer).GetCard(ctx, in) return srv.(CRMServer).GetCart(ctx, in)
} }
info := &grpc.UnaryServerInfo{ info := &grpc.UnaryServerInfo{
Server: srv, Server: srv,
FullMethod: CRM_GetCard_FullMethodName, FullMethod: CRM_GetCart_FullMethodName,
} }
handler := func(ctx context.Context, req interface{}) (interface{}, error) { handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(CRMServer).GetCard(ctx, req.(*CardReq)) return srv.(CRMServer).GetCart(ctx, req.(*CartReq))
} }
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
@ -319,8 +319,8 @@ var CRM_ServiceDesc = grpc.ServiceDesc{
Handler: _CRM_Order_Handler, Handler: _CRM_Order_Handler,
}, },
{ {
MethodName: "GetCard", MethodName: "GetCart",
Handler: _CRM_GetCard_Handler, Handler: _CRM_GetCart_Handler,
}, },
{ {
MethodName: "GetImage", MethodName: "GetImage",

View File

@ -16,14 +16,14 @@
"application/json" "application/json"
], ],
"paths": { "paths": {
"/card": { "/cart": {
"post": { "post": {
"operationId": "CRM_GetCard", "operationId": "CRM_GetCart",
"responses": { "responses": {
"200": { "200": {
"description": "A successful response.", "description": "A successful response.",
"schema": { "schema": {
"$ref": "#/definitions/crmCardRsp" "$ref": "#/definitions/crmCartRsp"
} }
}, },
"default": { "default": {
@ -292,7 +292,7 @@
} }
} }
}, },
"crmCardItem": { "crmCartItem": {
"type": "object", "type": "object",
"properties": { "properties": {
"id": { "id": {
@ -349,15 +349,23 @@
} }
} }
}, },
"crmCardRsp": { "crmCartRsp": {
"type": "object", "type": "object",
"properties": { "properties": {
"items": { "items": {
"type": "array", "type": "array",
"items": { "items": {
"type": "object", "type": "object",
"$ref": "#/definitions/crmCardItem" "$ref": "#/definitions/crmCartItem"
} }
},
"amount": {
"type": "string",
"format": "int64"
},
"amountOld": {
"type": "string",
"format": "int64"
} }
} }
}, },