package app import ( "cake_crm/internal/models/storage" crm "cake_crm/proto" "context" ) type Server struct { crm.UnimplementedCRMServer storage storage.IStorage } func NewServer(storage storage.IStorage) *Server { return &Server{ storage: storage, } } func (s *Server) GetCatalog(ctx context.Context, _ *crm.GetCatalogReq) (*crm.CatalogRsp, error) { categories, err := s.storage.GetCatalog(ctx) if err != nil { return nil, err } return &crm.CatalogRsp{Categories: categories}, nil } func (s *Server) GetPositions(ctx context.Context, req *crm.GetPositionsReq) (*crm.PositionsRsp, error) { products, err := s.storage.GetPositions(ctx, req.Id) if err != nil { return nil, err } return &crm.PositionsRsp{Products: products}, nil }