add catalog

This commit is contained in:
2024-05-18 12:12:00 +07:00
parent 286048d068
commit be7b5c505e
5 changed files with 74 additions and 28 deletions
+26
View File
@@ -0,0 +1,26 @@
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
}