diff --git a/api/main.proto b/api/main.proto index 2af1cc6..dfed247 100644 --- a/api/main.proto +++ b/api/main.proto @@ -37,9 +37,9 @@ service CRM { body: "order" }; } - rpc GetCard(CardReq) returns (CardRsp) { + rpc GetCart(CartReq) returns (CartRsp) { option (google.api.http) = { - post: "/card" + post: "/cart" body: "items" }; } @@ -146,7 +146,7 @@ message OrderItem { int64 count = 2; } -message CardItem { +message CartItem { int64 id = 1; string article = 2; string name = 3; @@ -161,12 +161,14 @@ message CardItem { repeated Label labels = 14; } -message CardReq { +message CartReq { repeated OrderItem items = 1; } -message CardRsp { - repeated CardItem items = 1; +message CartRsp { + repeated CartItem items = 1; + int64 amount = 2; + int64 amountOld = 3; } message GetImageReq { diff --git a/api/request.http b/api/request.http index f1f13ab..29fcca2 100644 --- a/api/request.http +++ b/api/request.http @@ -1,10 +1,14 @@ -POST http://localhost:8090/card +POST http://localhost:8090/cart content-type: application/json [ { "product_id": 1, "count": 7 + }, + { + "product_id": 20, + "count": 15 } ] @@ -20,6 +24,10 @@ content-type: application/json { "product_id": 1, "count": 7 + }, + { + "product_id": 20, + "count": 15 } ] } diff --git a/cmd/cake_crm/main.go b/cmd/cake_crm/main.go index e5b25b7..805a4d8 100644 --- a/cmd/cake_crm/main.go +++ b/cmd/cake_crm/main.go @@ -4,7 +4,7 @@ import ( "cake_crm/internal/app" "cake_crm/internal/modules/messenger/telegram" "cake_crm/internal/modules/storage/storage_file" - "cake_crm/internal/services/card" + "cake_crm/internal/services/cart" "cake_crm/internal/services/order" proto "cake_crm/proto" "context" @@ -22,7 +22,7 @@ import ( func main() { storage := storage_file.NewStorageFile() - cardService := card.NewService(storage) + cartService := cart.NewService(storage) orderService := order.NewService() @@ -55,7 +55,7 @@ func main() { // Create a gRPC server object s := grpc.NewServer() // 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 log.Println("Serving gRPC on 0.0.0.0:8080") go func() { diff --git a/internal/app/server.go b/internal/app/server.go index 1ea62e0..85d831f 100644 --- a/internal/app/server.go +++ b/internal/app/server.go @@ -3,7 +3,7 @@ package app import ( "cake_crm/internal/modules/messenger" "cake_crm/internal/modules/storage" - "cake_crm/internal/services/card" + "cake_crm/internal/services/cart" "cake_crm/internal/services/order" proto "cake_crm/proto" "context" @@ -16,20 +16,20 @@ type Server struct { proto.UnsafeCRMServer storage storage.IStorage messenger messenger.IMessenger - cardService *card.Service + cartService *cart.Service orderService *order.Service } func NewServer( storage storage.IStorage, messenger messenger.IMessenger, - cardService *card.Service, + cartService *cart.Service, orderService *order.Service, ) proto.CRMServer { return &Server{ storage: storage, messenger: messenger, - cardService: cardService, + cartService: cartService, 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) { - enrichItems, err := s.cardService.GetCard(ctx, req.Order.Items) + enrichItems, err := s.cartService.GetCart(ctx, req.Order.Items) if err != nil { 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) } -func (s *Server) GetCard(ctx context.Context, req *proto.CardReq) (*proto.CardRsp, error) { - enrichItems, err := s.cardService.GetCard(ctx, req.Items) +func (s *Server) GetCart(ctx context.Context, req *proto.CartReq) (*proto.CartRsp, error) { + resp, err := s.cartService.GetCart(ctx, req.Items) if err != nil { return nil, err } - return &proto.CardRsp{Items: enrichItems}, nil + return resp, nil } func (s *Server) GetImage(_ context.Context, req *proto.GetImageReq) (*httpbody.HttpBody, error) { diff --git a/internal/services/card/card.go b/internal/services/cart/cart.go similarity index 83% rename from internal/services/card/card.go rename to internal/services/cart/cart.go index 47a24f3..3debcab 100644 --- a/internal/services/card/card.go +++ b/internal/services/cart/cart.go @@ -1,4 +1,4 @@ -package card +package cart import ( "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) { - res := make([]*proto.CardItem, 0, len(items)) +func (s *Service) GetCart(ctx context.Context, items []*proto.OrderItem) (*proto.CartRsp, error) { + var cartAmount int64 + var cartAmountOld int64 + res := make([]*proto.CartItem, 0, len(items)) for _, item := range items { product, err := s.storage.GetProduct(ctx, item.ProductId) if err != nil { @@ -41,7 +43,7 @@ func (s *Service) GetCard(ctx context.Context, items []*proto.OrderItem) ([]*pro } res = append( res, - &proto.CardItem{ + &proto.CartItem{ Id: product.Id, Article: product.Article, Name: product.Name, @@ -56,8 +58,14 @@ func (s *Service) GetCard(ctx context.Context, items []*proto.OrderItem) ([]*pro 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) { diff --git a/internal/services/order/order.go b/internal/services/order/order.go index 0e7295c..4f8d531 100644 --- a/internal/services/order/order.go +++ b/internal/services/order/order.go @@ -13,12 +13,11 @@ func NewService() *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{} - var orderAmount int64 buffer.WriteString(fmt.Sprintf("Заказ от:\n%s\n%s\n", req.Order.Name, req.Order.Phone)) buffer.WriteString("\n") - for _, item := range items { + for _, item := range cart.Items { buffer.WriteString(item.Name) buffer.WriteString("\n") unit, err := unitToText(item.Unit) @@ -26,12 +25,11 @@ func (s *Service) CreateOrderText(req *proto.OrderReq, items []*proto.CardItem) return "", err } 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("\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 } diff --git a/proto/main.pb.go b/proto/main.pb.go index c1ae4f4..266b5b4 100644 --- a/proto/main.pb.go +++ b/proto/main.pb.go @@ -1090,7 +1090,7 @@ func (x *OrderItem) GetCount() int64 { return 0 } -type CardItem struct { +type CartItem struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -1109,8 +1109,8 @@ type CardItem struct { Labels []*Label `protobuf:"bytes,14,rep,name=labels,proto3" json:"labels,omitempty"` } -func (x *CardItem) Reset() { - *x = CardItem{} +func (x *CartItem) Reset() { + *x = CartItem{} if protoimpl.UnsafeEnabled { mi := &file_main_proto_msgTypes[19] 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) } -func (*CardItem) ProtoMessage() {} +func (*CartItem) ProtoMessage() {} -func (x *CardItem) ProtoReflect() protoreflect.Message { +func (x *CartItem) ProtoReflect() protoreflect.Message { mi := &file_main_proto_msgTypes[19] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1136,96 +1136,96 @@ func (x *CardItem) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use CardItem.ProtoReflect.Descriptor instead. -func (*CardItem) Descriptor() ([]byte, []int) { +// Deprecated: Use CartItem.ProtoReflect.Descriptor instead. +func (*CartItem) Descriptor() ([]byte, []int) { return file_main_proto_rawDescGZIP(), []int{19} } -func (x *CardItem) GetId() int64 { +func (x *CartItem) GetId() int64 { if x != nil { return x.Id } return 0 } -func (x *CardItem) GetArticle() string { +func (x *CartItem) GetArticle() string { if x != nil { return x.Article } return "" } -func (x *CardItem) GetName() string { +func (x *CartItem) GetName() string { if x != nil { return x.Name } return "" } -func (x *CardItem) GetUri() string { +func (x *CartItem) GetUri() string { if x != nil { return x.Uri } return "" } -func (x *CardItem) GetImages() []string { +func (x *CartItem) GetImages() []string { if x != nil { return x.Images } return nil } -func (x *CardItem) GetUnit() string { +func (x *CartItem) GetUnit() string { if x != nil { return x.Unit } return "" } -func (x *CardItem) GetInventory() float64 { +func (x *CartItem) GetInventory() float64 { if x != nil { return x.Inventory } return 0 } -func (x *CardItem) GetCount() int64 { +func (x *CartItem) GetCount() int64 { if x != nil { return x.Count } return 0 } -func (x *CardItem) GetAmount() int64 { +func (x *CartItem) GetAmount() int64 { if x != nil { return x.Amount } return 0 } -func (x *CardItem) GetAmountOld() int64 { +func (x *CartItem) GetAmountOld() int64 { if x != nil { return x.AmountOld } return 0 } -func (x *CardItem) GetVariants() []*Variant { +func (x *CartItem) GetVariants() []*Variant { if x != nil { return x.Variants } return nil } -func (x *CardItem) GetLabels() []*Label { +func (x *CartItem) GetLabels() []*Label { if x != nil { return x.Labels } return nil } -type CardReq struct { +type CartReq struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -1233,8 +1233,8 @@ type CardReq struct { Items []*OrderItem `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"` } -func (x *CardReq) Reset() { - *x = CardReq{} +func (x *CartReq) Reset() { + *x = CartReq{} if protoimpl.UnsafeEnabled { mi := &file_main_proto_msgTypes[20] 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) } -func (*CardReq) ProtoMessage() {} +func (*CartReq) ProtoMessage() {} -func (x *CardReq) ProtoReflect() protoreflect.Message { +func (x *CartReq) ProtoReflect() protoreflect.Message { mi := &file_main_proto_msgTypes[20] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1260,28 +1260,30 @@ func (x *CardReq) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use CardReq.ProtoReflect.Descriptor instead. -func (*CardReq) Descriptor() ([]byte, []int) { +// Deprecated: Use CartReq.ProtoReflect.Descriptor instead. +func (*CartReq) Descriptor() ([]byte, []int) { return file_main_proto_rawDescGZIP(), []int{20} } -func (x *CardReq) GetItems() []*OrderItem { +func (x *CartReq) GetItems() []*OrderItem { if x != nil { return x.Items } return nil } -type CardRsp struct { +type CartRsp struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache 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() { - *x = CardRsp{} +func (x *CartRsp) Reset() { + *x = CartRsp{} if protoimpl.UnsafeEnabled { mi := &file_main_proto_msgTypes[21] 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) } -func (*CardRsp) ProtoMessage() {} +func (*CartRsp) ProtoMessage() {} -func (x *CardRsp) ProtoReflect() protoreflect.Message { +func (x *CartRsp) ProtoReflect() protoreflect.Message { mi := &file_main_proto_msgTypes[21] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1307,18 +1309,32 @@ func (x *CardRsp) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use CardRsp.ProtoReflect.Descriptor instead. -func (*CardRsp) Descriptor() ([]byte, []int) { +// Deprecated: Use CartRsp.ProtoReflect.Descriptor instead. +func (*CartRsp) Descriptor() ([]byte, []int) { return file_main_proto_rawDescGZIP(), []int{21} } -func (x *CardRsp) GetItems() []*CardItem { +func (x *CartRsp) GetItems() []*CartItem { if x != nil { return x.Items } 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 { state protoimpl.MessageState 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, 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, - 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, 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, @@ -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, 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, 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, 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, - 0x43, 0x61, 0x72, 0x64, 0x52, 0x73, 0x70, 0x12, 0x29, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, + 0x72, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x22, 0x6a, 0x0a, 0x07, + 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, - 0x72, 0x6d, 0x2e, 0x43, 0x61, 0x72, 0x64, 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, - 0x71, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x32, 0xe0, 0x04, 0x0a, 0x03, 0x43, 0x52, 0x4d, 0x12, 0x4f, 0x0a, - 0x0a, 0x47, 0x65, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x18, 0x2e, 0x63, 0x72, - 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, - 0x6f, 0x67, 0x52, 0x65, 0x71, 0x1a, 0x15, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, - 0x6d, 0x2e, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x73, 0x70, 0x22, 0x10, 0x82, 0xd3, - 0xe4, 0x93, 0x02, 0x0a, 0x12, 0x08, 0x2f, 0x63, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x5c, - 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1a, - 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x6f, - 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x17, 0x2e, 0x63, 0x72, 0x61, - 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x52, 0x73, 0x70, 0x22, 0x17, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x11, 0x12, 0x0f, 0x2f, 0x70, 0x6f, - 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x12, 0x55, 0x0a, 0x0a, - 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x12, 0x18, 0x2e, 0x63, 0x72, 0x61, - 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, - 0x74, 0x52, 0x65, 0x71, 0x1a, 0x15, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, - 0x2e, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x73, 0x70, 0x22, 0x16, 0x82, 0xd3, 0xe4, - 0x93, 0x02, 0x10, 0x12, 0x0e, 0x2f, 0x70, 0x72, 0x6f, 0x64, 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, 0x12, 0x1c, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, - 0x6d, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x72, 0x65, 0x61, 0x64, 0x63, 0x72, 0x75, 0x6d, 0x62, 0x73, - 0x52, 0x65, 0x71, 0x1a, 0x19, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, - 0x42, 0x72, 0x65, 0x61, 0x64, 0x63, 0x72, 0x75, 0x6d, 0x62, 0x73, 0x52, 0x73, 0x70, 0x22, 0x22, - 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1c, 0x12, 0x1a, 0x2f, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, - 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x2f, 0x62, 0x72, 0x65, 0x61, 0x64, 0x63, 0x72, 0x75, 0x6d, - 0x62, 0x73, 0x12, 0x49, 0x0a, 0x05, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x13, 0x2e, 0x63, 0x72, - 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, - 0x1a, 0x13, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x4f, 0x72, 0x64, - 0x65, 0x72, 0x52, 0x73, 0x70, 0x22, 0x16, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x10, 0x3a, 0x05, 0x6f, - 0x72, 0x64, 0x65, 0x72, 0x22, 0x07, 0x2f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x73, 0x12, 0x47, 0x0a, - 0x07, 0x47, 0x65, 0x74, 0x43, 0x61, 0x72, 0x64, 0x12, 0x12, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, - 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x43, 0x61, 0x72, 0x64, 0x52, 0x65, 0x71, 0x1a, 0x12, 0x2e, 0x63, - 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x43, 0x61, 0x72, 0x64, 0x52, 0x73, 0x70, - 0x22, 0x14, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0e, 0x3a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x22, - 0x05, 0x2f, 0x63, 0x61, 0x72, 0x64, 0x12, 0x50, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x49, 0x6d, 0x61, - 0x67, 0x65, 0x12, 0x16, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x47, - 0x65, 0x74, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 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, + 0x72, 0x6d, 0x2e, 0x43, 0x61, 0x72, 0x74, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x05, 0x69, 0x74, 0x65, + 0x6d, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x6d, + 0x6f, 0x75, 0x6e, 0x74, 0x4f, 0x6c, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x61, + 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x4f, 0x6c, 0x64, 0x22, 0x21, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x49, + 0x6d, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x32, 0xe0, 0x04, 0x0a, 0x03, + 0x43, 0x52, 0x4d, 0x12, 0x4f, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, + 0x67, 0x12, 0x18, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x47, 0x65, + 0x74, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x1a, 0x15, 0x2e, 0x63, 0x72, + 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x43, 0x61, 0x74, 0x61, 0x6c, 0x6f, 0x67, 0x52, + 0x73, 0x70, 0x22, 0x10, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0a, 0x12, 0x08, 0x2f, 0x63, 0x61, 0x74, + 0x61, 0x6c, 0x6f, 0x67, 0x12, 0x5c, 0x0a, 0x0c, 0x47, 0x65, 0x74, 0x50, 0x6f, 0x73, 0x69, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1a, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, + 0x2e, 0x47, 0x65, 0x74, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, + 0x1a, 0x17, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x50, 0x6f, 0x73, + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x73, 0x70, 0x22, 0x17, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x11, 0x12, 0x0f, 0x2f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x7b, 0x69, + 0x64, 0x7d, 0x12, 0x55, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, + 0x12, 0x18, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x47, 0x65, 0x74, + 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x15, 0x2e, 0x63, 0x72, 0x61, + 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x73, + 0x70, 0x22, 0x16, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x10, 0x12, 0x0e, 0x2f, 0x70, 0x72, 0x6f, 0x64, + 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, 0x12, 0x1c, 0x2e, 0x63, 0x72, + 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x72, 0x65, 0x61, 0x64, + 0x63, 0x72, 0x75, 0x6d, 0x62, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x19, 0x2e, 0x63, 0x72, 0x61, 0x62, + 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x42, 0x72, 0x65, 0x61, 0x64, 0x63, 0x72, 0x75, 0x6d, 0x62, + 0x73, 0x52, 0x73, 0x70, 0x22, 0x22, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1c, 0x12, 0x1a, 0x2f, 0x70, + 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x2f, 0x62, 0x72, 0x65, + 0x61, 0x64, 0x63, 0x72, 0x75, 0x6d, 0x62, 0x73, 0x12, 0x49, 0x0a, 0x05, 0x4f, 0x72, 0x64, 0x65, + 0x72, 0x12, 0x13, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x4f, 0x72, + 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, 0x13, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, + 0x72, 0x6d, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x73, 0x70, 0x22, 0x16, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x10, 0x3a, 0x05, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x22, 0x07, 0x2f, 0x6f, 0x72, 0x64, + 0x65, 0x72, 0x73, 0x12, 0x47, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x43, 0x61, 0x72, 0x74, 0x12, 0x12, + 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x43, 0x61, 0x72, 0x74, 0x52, + 0x65, 0x71, 0x1a, 0x12, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x43, + 0x61, 0x72, 0x74, 0x52, 0x73, 0x70, 0x22, 0x14, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0e, 0x3a, 0x05, + 0x69, 0x74, 0x65, 0x6d, 0x73, 0x22, 0x05, 0x2f, 0x63, 0x61, 0x72, 0x74, 0x12, 0x50, 0x0a, 0x08, + 0x47, 0x65, 0x74, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x12, 0x16, 0x2e, 0x63, 0x72, 0x61, 0x62, 0x73, + 0x2e, 0x63, 0x72, 0x6d, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, + 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 ( @@ -1576,9 +1596,9 @@ var file_main_proto_goTypes = []interface{}{ (*OrderRsp)(nil), // 16: crabs.crm.OrderRsp (*Order)(nil), // 17: crabs.crm.Order (*OrderItem)(nil), // 18: crabs.crm.OrderItem - (*CardItem)(nil), // 19: crabs.crm.CardItem - (*CardReq)(nil), // 20: crabs.crm.CardReq - (*CardRsp)(nil), // 21: crabs.crm.CardRsp + (*CartItem)(nil), // 19: crabs.crm.CartItem + (*CartReq)(nil), // 20: crabs.crm.CartReq + (*CartRsp)(nil), // 21: crabs.crm.CartRsp (*GetImageReq)(nil), // 22: crabs.crm.GetImageReq (*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 17, // 10: crabs.crm.OrderReq.order:type_name -> crabs.crm.Order 18, // 11: crabs.crm.Order.items:type_name -> crabs.crm.OrderItem - 7, // 12: crabs.crm.CardItem.variants:type_name -> crabs.crm.Variant - 10, // 13: crabs.crm.CardItem.labels:type_name -> crabs.crm.Label - 18, // 14: crabs.crm.CardReq.items:type_name -> crabs.crm.OrderItem - 19, // 15: crabs.crm.CardRsp.items:type_name -> crabs.crm.CardItem + 7, // 12: crabs.crm.CartItem.variants:type_name -> crabs.crm.Variant + 10, // 13: crabs.crm.CartItem.labels:type_name -> crabs.crm.Label + 18, // 14: crabs.crm.CartReq.items:type_name -> crabs.crm.OrderItem + 19, // 15: crabs.crm.CartRsp.items:type_name -> crabs.crm.CartItem 0, // 16: crabs.crm.CRM.GetCatalog:input_type -> crabs.crm.GetCatalogReq 3, // 17: crabs.crm.CRM.GetPositions:input_type -> crabs.crm.GetPositionsReq 11, // 18: crabs.crm.CRM.GetProduct:input_type -> crabs.crm.GetProductReq 13, // 19: crabs.crm.CRM.GetBreadcrumbs:input_type -> crabs.crm.GetBreadcrumbsReq 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 1, // 23: crabs.crm.CRM.GetCatalog:output_type -> crabs.crm.CatalogRsp 4, // 24: crabs.crm.CRM.GetPositions:output_type -> crabs.crm.PositionsRsp 12, // 25: crabs.crm.CRM.GetProduct:output_type -> crabs.crm.ProductRsp 14, // 26: crabs.crm.CRM.GetBreadcrumbs:output_type -> crabs.crm.BreadcrumbsRsp 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, // [23:30] is the sub-list for method output_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{} { - switch v := v.(*CardItem); i { + switch v := v.(*CartItem); i { case 0: return &v.state case 1: @@ -1867,7 +1887,7 @@ func file_main_proto_init() { } } file_main_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CardReq); i { + switch v := v.(*CartReq); i { case 0: return &v.state case 1: @@ -1879,7 +1899,7 @@ func file_main_proto_init() { } } file_main_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CardRsp); i { + switch v := v.(*CartRsp); i { case 0: return &v.state case 1: diff --git a/proto/main.pb.gw.go b/proto/main.pb.gw.go index db818ef..9d37114 100644 --- a/proto/main.pb.gw.go +++ b/proto/main.pb.gw.go @@ -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) { - var protoReq CardReq +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 CartReq var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Items); err != nil && err != io.EOF { 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 } -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) { - var protoReq CardReq +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 CartReq var metadata runtime.ServerMetadata if err := marshaler.NewDecoder(req.Body).Decode(&protoReq.Items); err != nil && err != io.EOF { 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 } @@ -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()) defer cancel() var stream runtime.ServerTransportStream @@ -448,12 +448,12 @@ func RegisterCRMHandlerServer(ctx context.Context, mux *runtime.ServeMux, server inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error 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 { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 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()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { @@ -461,7 +461,7 @@ func RegisterCRMHandlerServer(ctx context.Context, mux *runtime.ServeMux, server 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()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error 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 { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 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) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) 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_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"}, "")) ) @@ -715,7 +715,7 @@ var ( forward_CRM_Order_0 = runtime.ForwardResponseMessage - forward_CRM_GetCard_0 = runtime.ForwardResponseMessage + forward_CRM_GetCart_0 = runtime.ForwardResponseMessage forward_CRM_GetImage_0 = runtime.ForwardResponseMessage ) diff --git a/proto/main_grpc.pb.go b/proto/main_grpc.pb.go index 34b4e23..e85aa21 100644 --- a/proto/main_grpc.pb.go +++ b/proto/main_grpc.pb.go @@ -25,7 +25,7 @@ const ( CRM_GetProduct_FullMethodName = "/crabs.crm.CRM/GetProduct" CRM_GetBreadcrumbs_FullMethodName = "/crabs.crm.CRM/GetBreadcrumbs" 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" ) @@ -38,7 +38,7 @@ type CRMClient interface { GetProduct(ctx context.Context, in *GetProductReq, opts ...grpc.CallOption) (*ProductRsp, error) GetBreadcrumbs(ctx context.Context, in *GetBreadcrumbsReq, opts ...grpc.CallOption) (*BreadcrumbsRsp, 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) } @@ -95,9 +95,9 @@ func (c *cRMClient) Order(ctx context.Context, in *OrderReq, opts ...grpc.CallOp return out, nil } -func (c *cRMClient) GetCard(ctx context.Context, in *CardReq, opts ...grpc.CallOption) (*CardRsp, error) { - out := new(CardRsp) - err := c.cc.Invoke(ctx, CRM_GetCard_FullMethodName, in, out, opts...) +func (c *cRMClient) GetCart(ctx context.Context, in *CartReq, opts ...grpc.CallOption) (*CartRsp, error) { + out := new(CartRsp) + err := c.cc.Invoke(ctx, CRM_GetCart_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -122,7 +122,7 @@ type CRMServer interface { GetProduct(context.Context, *GetProductReq) (*ProductRsp, error) GetBreadcrumbs(context.Context, *GetBreadcrumbsReq) (*BreadcrumbsRsp, 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) mustEmbedUnimplementedCRMServer() } @@ -146,8 +146,8 @@ func (UnimplementedCRMServer) GetBreadcrumbs(context.Context, *GetBreadcrumbsReq func (UnimplementedCRMServer) Order(context.Context, *OrderReq) (*OrderRsp, error) { return nil, status.Errorf(codes.Unimplemented, "method Order not implemented") } -func (UnimplementedCRMServer) GetCard(context.Context, *CardReq) (*CardRsp, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetCard not implemented") +func (UnimplementedCRMServer) GetCart(context.Context, *CartReq) (*CartRsp, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetCart not implemented") } func (UnimplementedCRMServer) GetImage(context.Context, *GetImageReq) (*httpbody.HttpBody, error) { 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) } -func _CRM_GetCard_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CardReq) +func _CRM_GetCart_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CartReq) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(CRMServer).GetCard(ctx, in) + return srv.(CRMServer).GetCart(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: CRM_GetCard_FullMethodName, + FullMethod: CRM_GetCart_FullMethodName, } 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) } @@ -319,8 +319,8 @@ var CRM_ServiceDesc = grpc.ServiceDesc{ Handler: _CRM_Order_Handler, }, { - MethodName: "GetCard", - Handler: _CRM_GetCard_Handler, + MethodName: "GetCart", + Handler: _CRM_GetCart_Handler, }, { MethodName: "GetImage", diff --git a/resources/main.swagger.json b/resources/main.swagger.json index 9515a76..3110493 100644 --- a/resources/main.swagger.json +++ b/resources/main.swagger.json @@ -16,14 +16,14 @@ "application/json" ], "paths": { - "/card": { + "/cart": { "post": { - "operationId": "CRM_GetCard", + "operationId": "CRM_GetCart", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/crmCardRsp" + "$ref": "#/definitions/crmCartRsp" } }, "default": { @@ -292,7 +292,7 @@ } } }, - "crmCardItem": { + "crmCartItem": { "type": "object", "properties": { "id": { @@ -349,15 +349,23 @@ } } }, - "crmCardRsp": { + "crmCartRsp": { "type": "object", "properties": { "items": { "type": "array", "items": { "type": "object", - "$ref": "#/definitions/crmCardItem" + "$ref": "#/definitions/crmCartItem" } + }, + "amount": { + "type": "string", + "format": "int64" + }, + "amountOld": { + "type": "string", + "format": "int64" } } },