@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user